Iteration and For-Each Loops
Iteration
Iteration is a repeating portion of an algorithm. Iteration repeats a specified number of times, or until a given condition is met.If we want to ask the user to enter 5 numbers and sum them, it is repetitive to do this:
For example, if we want to print a message 5 times:
for loops
Iteration loops are frequently referred to as for loops, because for is the keyword that is used to introduce them in nearly all programming languages, including Python.Python's for loop iterates over items of a sequence (for example a list of numbers, or a string, which is a sequence of characters) and processes them with some code.