the statements that are processed under the control of a for or while operator in python

In Python, the statements that are processed under the control of a for or while loop are indented and placed after the loop statement. The syntax for a for loop is as follows:

main.py
for item in iterable:
    # statements to be executed inside the for loop
74 chars
3 lines

Where item is a variable that iterates over the iterable sequence, and the statements that are executed inside the for loop should be indented.

The syntax for a while loop is as follows:

main.py
while condition:
    # statements to be executed inside the while loop
71 chars
3 lines

Where condition is a statement that evaluates to a boolean value, and the statements that are executed inside the while loop should also be indented. The while loop will continue to execute as long as the condition remains True.

gistlibby LogSnag