Lesson 4. For loop with range
5/12. Range: starting with the example
Another use case is to iterate over some integer variable in increasing or decreasing order. Such a sequence of integers can be created using the functionrange(min_value, max_value)
:
Instructions
Click "Run" to see what happens in output!
And now we wish to explain how does
range()
work in details. Press "Continue" for that.
for i in range(5, 8): print(i, i ** 2) print('end of loop')