For-loop (or simply for loop) is a control flow statement for specifying iteration, which allows code to be executed repeatedly.
For Loop Example
fruits = ["apple", "banana", "cherry"] for x in fruits: print(x) ’’’ Iterating String for x in "banana": print(x)
Range() Function in python
The built-in range function in Python is very useful to generate sequences of numbers in the form of a list. The given end point is never part of the generated list.
for x in range(6): print(x) Output: 0 1 2 3 4 5