Loops
Python Loops
While loops are like if statements, you do something while a condition is true
For Loops loop through something like a string, a list, or a dictionary.
name = "John"
for x in name:
print (x) # prints J then o then h then n
fav_pizza = {
"John": "Pepperoni",
"Bob": "Cheese",
"Tina": "Supreme"
}
for key, value in fav_pizza.items():
print(key, value) # will go through the dictionary using the items function. Variables could be anything like name, style.