9.0k views
4 votes
Both of the following for clauses would generate the same number of loop iterations.

for num in range(4):
for num in range(1, 5):

User Lecsox
by
6.2k points

1 Answer

4 votes

Answer:

True, both the for clause can generate equal number iteration of loop that is 4.

Step-by-step explanation:

Following are the code in the Python Programming Language, in which

  • The range of the first for loop is only 4, which means the following loop will start from 1 and end at 4.
  • In the second for loop, the range is 1 to 5, which means the following for loop will starts from 1 and end at less than 5 that is 4.

So, that's why both of the for loop will iterate at the same range.

User Roman Nazarevych
by
5.6k points