119k views
1 vote
In which of the following cases would you use the for loop in Python?

-None of the options
-When you know exactly the number of times you want to iterate over a block of code
- When you want to reuse the code in Python -When you don't know the number of times you want to iterate over a block of code​

User Isurujay
by
7.5k points

1 Answer

5 votes

Answer:

for loops are used when you have a block of code which you want to repeat a fixed number of times. The for-loop is always used in combination with an iterable object, like a list or a range. The Python for statement iterates over the members of a sequence in order, executing the block each time.

Step-by-step explanation:

User Abhay Singh
by
8.2k points