-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloops.py
40 lines (30 loc) · 823 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
#
# Example file for working with loops
# LinkedIn Learning Python course by Joe Marini
#
def main():
x = 0
# # TODO: define a while loop
# while(x<5):
# print(x)
# x += 1
# # TODO: define a for loop
# for x in range(5,10):
# print(x)
# # TODO: use a for loop over a collection
# days = ["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]
# for d in days:
# print(d)
# # TODO: use the break and continue statements
# for x in range(5,10):
# # if x==7:
# # break
# if x%2==0:
# continue
# print(x)
# TODO: using the enumerate() function to get index
days = ["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]
for i,d in enumerate(days):
print(i, d)
if __name__ == "__main__":
main()