-
Notifications
You must be signed in to change notification settings - Fork 0
/
loops.py
42 lines (32 loc) · 775 Bytes
/
loops.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# value = 0
# while value <= 10:
# value += 1
# if value == 5:
# continue
# print(value)
# else:
# print("Loop ended " + str(value))
names = ["John", "Paul", "George", "Ringo"]
for name in names:
if name == "George":
continue
print(name)
for i in "Mississippi":
print(i)
for name in names:
if name == "Paul":
break
print(name)
for i in range(10, 20, 5):
print(i)
else:
print("Loop ended " + str(i))
names = ["John", "Paul", "George", "Ringo"]
actions = ["singing", "playing guitar", "playing bass", "playing drums"]
for name in names:
for action in actions:
print(name + " is " + action)
print("\n")
# for name, action in zip(names, actions):
# print(name + " is " + action)
# print("\n")