Python for loop in list:
veggieList = [‘spinach’, ‘zucchini’, ‘squash’, ‘broccoli’, ‘arugula’]
for vegetable in veggieList:
print(“I like to eat ” + vegetable)
Python if/else:
myVariable = 234
if myVariable == 123:
print(“hello”)
elif myVariable == 234:
print(“what’s up?”)
else:
print(“bye”)
Python for loop (range):
import time
for i in range(1, 20):
for i in range(1, 10):
print(“a” * i)
time.sleep(0.03)
for i in range (1, 10):
print(“a” * (10 – i))
time.sleep(0.03)
Python while loop:
iterator = 0
while iterator < 25:
print(“You can do it!”)
iterator += 1