Searching for: For In Loop in Python
The for loop is used to iterate through a sequence. When a range is provided as the sequence, it behaves like a C-style for loop. For all other sequences (arrays, etc.), it behaves like a for each loop.
The while loop executes a block of code while a boolean expression evaluates to true. It terminates as soon as the expression evaluates to false. The boolean expression is evaluated before each iteration.
Generators are functions used to create an iterable sequence of values.