UrbanPro

Learn Python Training from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

What is iterative statement in python?

Asked by Last Modified  

3 Answers

Learn Python

Follow 2
Answer

Please enter your answer

Python trainer believe in practical learning.

In Python, an iterative statement (also known as a loop) is a control flow statement that allows the programmer to execute a block of code repeatedly until a certain condition is met. There are two types of iterative statements in Python: 1. `for` loop: This loop is used for iterating over a sequence...
read more

In Python, an iterative statement (also known as a loop) is a control flow statement that allows the programmer to execute a block of code repeatedly until a certain condition is met. There are two types of iterative statements in Python:

1. `for` loop: This loop is used for iterating over a sequence (such as a list, tuple, string, or range), or any other iterable object. The general syntax of a `for` loop is:

```
for variable in sequence:
# code to be executed
```

In this syntax, the `variable` takes the value of each item in the `sequence` one by one, and the code inside the loop is executed for each value of `variable`.

2. `while` loop: This loop is used for executing a block of code repeatedly as long as a certain condition is true. The general syntax of a `while` loop is:

```
while condition:
# code to be executed
```

In this syntax, the `condition` is checked at the beginning of each iteration of the loop, and if it is true, the code inside the loop is executed. The loop continues until the `condition` becomes false.

Here is an example of a `for` loop that iterates over a list of numbers and prints each number:
```python
numbers = [1, 2, 3, 4, 5]
for num in numbers:
print(num)
```

And here is an example of a `while` loop that counts from 1 to 5 and prints each number:
count = 1
while count <= 5:
print(count)
count += 1

read less
Comments

In Python, the iterative statements are also known as looping statements or repetitive statements. The iterative statements are used to execute a part of the program repeatedly as long as a given condition is True.
Comments

Iteration is simply the number of time/times a loop can be executed, display the values Ascending and Descending order
Comments

View 1 more Answers

Related Questions

I want to learn Python but I dont know which tool is better for the future? and i want to get a job in less time. I am a fresher, 2017 passed out.

Congratulations for passing out in 2017. Learning Python programming language will help you get a job in less time provided you are good in general aptitude,computer science fundamentals. You need to become...
Srinu
Can we code a website from python?
Yes, you can build a website with python. Python is a general purpose programming language. some of the benifits of building a web with python they are below. Easy to learn. Large library collection. Fast...
Mridulika
0 0
5
What is a beginner's guide to Python programming?
A beginner's guide to Python programming includes: 1. **Install Python**: Download Python from (https://python.org) and install it.2. **Learn Syntax**: Start with basics like variables, loops, and conditions.3....
Dharmendra
0 0
6
What is Python primarily used for?
Python is primarily used for the following:Python libraries are used in Machine Learning, Deep Learning, Data Science, Artificial Intelligence fields.Python frameworks such as Django and Tkinter are used...
Raja
0 0
6

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Built-In Functions (Python)
Built-in Functions: The Python interpreter has a number of functions built into it that are always available. They are listed here in alphabetical order. Built-in Functions abs() divmod() input() open() staticmethod() all() enumerate() int() ord() str() any() eval() isinstance() pow() sum() basestring() execfile() issubclass() print() super() bin() file() iter() property() tuple() bool() filter() len() range() type() bytearray() float() list() raw_input() unichr() callable() format() locals() reduce() unicode() chr() frozenset() long() reload() vars() classmethod() getattr() map() repr() xrange() cmp() globals() max() reversed() zip() compile() hasattr() memoryview() round() __import__() complex() hash() min() set() ...

Write your first Python program in 10 minutes
1. Download python from python official site search "python download" in google 2. Install in your machine 3. verify using : "python --version" command 4. Write first program using notepad create...


OS Module
1. OS module interacts with your operating system. Use this to create folder, remove folder, move folder, change the working directory. Ex: import oscurDir=os.getcwd() #get current working directoryprint(curDir)os.mkdir('praveen')...

Recommended Articles

Python is one of the most popular programming languages in the world. It is general-purpose, object oriented, high-level programming language used in a number of programming fields. Python is a great programming language to learn as it will introduce you to the world of programming. If you are from the technical background...

Read full article >

Hadoop is a framework which has been developed for organizing and analysing big chunks of data for a business. Suppose you have a file larger than your system’s storage capacity and you can’t store it. Hadoop helps in storing bigger files than what could be stored on one particular server. You can therefore store very,...

Read full article >

Microsoft Excel is an electronic spreadsheet tool which is commonly used for financial and statistical data processing. It has been developed by Microsoft and forms a major component of the widely used Microsoft Office. From individual users to the top IT companies, Excel is used worldwide. Excel is one of the most important...

Read full article >

Applications engineering is a hot trend in the current IT market.  An applications engineer is responsible for designing and application of technology products relating to various aspects of computing. To accomplish this, he/she has to work collaboratively with the company’s manufacturing, marketing, sales, and customer...

Read full article >

Looking for Python Training classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for Python Training Classes?

The best tutors for Python Training Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn Python Training with the Best Tutors

The best Tutors for Python Training Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more