-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflowControlTransferExample.py
More file actions
63 lines (52 loc) · 873 Bytes
/
Copy pathflowControlTransferExample.py
File metadata and controls
63 lines (52 loc) · 873 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# 3) Transfer statement
# break
# continue
# pass
#break examples
# we can use else with for loop in break
i = 0
while True:
print("Hello")
i += 1
if i == 5:
break
#example2
cart = [12,30,50,302,500,900]
for i in cart:
if i > 500:
break;
print(i)
else:
print("Congrts all processed")
#Continue examples
for i in range(10):
if i%2 == 0:
continue
print(i)
#example2
cart = [12,30,50,302,500,900]
for i in cart:
if i >= 500:
print("Sorry we cant process this item",i)
continue
print(i)
#pass statement examples
# it is a keyword in python
# it is a empty stmt
# it won't do anything
if True:
pass
else:
print("Hello")
#example 2
def f1():
print("Hello")
def f2():
pass
f1()
#example 3
for i in range(100):
if i % 10 == 0:
print(i)
else:
pass