Files
Man1130/jupyter/Man1130-python-comission/course_materials/Note/a2-3-loop.py
louiscklaw e44aead3d5 update,
2025-02-01 01:58:19 +08:00

29 lines
483 B
Python

# you can download at
# https://goo.gl/WKdcqo
colors = ['red','blue','green']
for color in colors:
print('I love {}'.format(color))
range(3)
for i in range(3):
print(i)
for i in range(5):
print(i)
# break, pass, continue
for i in range(3):
cmd = input('Enter command: ')
if cmd == 'break':
break
elif cmd == 'pass':
pass
print('command is pass')
elif cmd == 'continue':
continue
print('command is continue')