-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloops.py
More file actions
39 lines (31 loc) · 1003 Bytes
/
Copy pathloops.py
File metadata and controls
39 lines (31 loc) · 1003 Bytes
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
#------------------list loop -----------
fruit_list = ["Apples","Papaya","Mango"]
for fruits in fruit_list:
print("Would you like {} ? ".format(fruits))
#------------------range loop-----------
for number in range(1,11):
print("Number {}".format(number))
# ------------------While loop-----------
temp_farenheit = 40
while temp_farenheit >32:
print("The water is {} degree.".format(temp_farenheit))
temp_farenheit -= 1
# ------------------ loop controls(BREAK CONTINUE PASS)-----------
# Break
while temp_farenheit >32:
print("The water is {} degree.".format(temp_farenheit))
temp_farenheit -= 1
if temp_farenheit == 33:
break
#continue
for number in range(1,11):
if number == 7:
print("We re skipping number 7 ")
continue
print("This is the number {}".format(number))
#pass
for number in range(1,11):
if number == 3 :
pass
else:
print("This number is {}".format(number))