-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWhile_Loop.py
More file actions
61 lines (57 loc) · 820 Bytes
/
Copy pathWhile_Loop.py
File metadata and controls
61 lines (57 loc) · 820 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
""" _______________________________ """
#!""" WHILE LOOP """
i=1
while i <= 10:
print(i)
i += 1
else:
print("The condition is not true") #? When i=11
print("The loop has ended")
""" #* The output is
1
2
3
4
5
6
7
8
9
10
The condition is not true
The loop has ended
"""
j=1
while j<=10:
j += 1
if j == 6:
continue #?skip this step
print(j)
print("The loop has ended")
""" #* The output is
2
3
4
5
7
8
9
10
11
The loop has ended
"""
k =1
while k<=10:
k += 1
if k ==6:
break #?finish the loop
print(k)
print("The loop has ended")
""" #* The output is
2
3
4
5
The loop has ended
"""
""" _______________________________ """