Note: In python, for loops only implements the collection-based iteration. When the above code is executed, it produces the following result −, An alternative way of iterating through each item is by index offset into the sequence itself. Contrast the for statement with the ''while'' loop, used when a condition needs to be checked each iteration, or to repeat a block of code forever. The sequence or collection could be Range, List, Tuple, Dictionary, Set or a String. The for loop in Python is used to iterate over a sequence (list, tuple, string) or other iterable objects. In Python, there is no C style for loop, i.e., for (i=0; i