For Loops
For loops
For loops
can be used to count the number of times a loop is to execute
can be used to iterate through a list
Counting Loop
Counting Loop
for ... in range ...
List processing
List processing
for ... in ...
# will loop from 0 to 9
for x in range (0, 10):
print (x)
# will also loop from 0 to 9
for x in range (10):
print (x)
# will iterate through each element of a list
listofthings = ["car", "ball", 17]
for thing in listofthings:
print (thing)