Loops are used to repetitively execute a sequence of statements while changing a variable from iteration to iteration. This variable is called the index variable. It is successively assigned to the elements of a list:
L = [1, 2, 10] for s in L: print(s * 2) # output: 2 4 20
The part to be repeated in the for loop has to be properly indented:
my_list = [...] # define a list
for elt in my_list:
... #do_something
... #something_else
print("loop finished") # outside the for block