Skip to content

Commit 6c0df5c

Browse files
lesson7loops
1 parent 0916589 commit 6c0df5c

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

7lesson.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# while loop
2+
3+
# i = 1
4+
# while i < 10:
5+
# print('looping number of i value is : {}'.format(i))
6+
# i += 1
7+
8+
# while loop exercise
9+
p = 0
10+
t = 5
11+
12+
# while t > p :
13+
# print('p is' , p, 't is' , t)
14+
# t -= 1
15+
16+
# break and continue
17+
18+
# for pt in 'pathein':
19+
# if pt == 'n':
20+
# break
21+
# print('without break')
22+
23+
# print('----------breaked--------------')
24+
25+
26+
# for pp in 'yangon':
27+
# if pp == 'n':
28+
# continue
29+
# print('without break',pp)
30+
# print('---------continue-----')
31+
32+
33+
34+
# while and break programm
35+
ls = [10,20,60,99]
36+
compareNum = 99
37+
found = False
38+
index = 0
39+
# print(len(ls))
40+
41+
while index < len(ls):
42+
if ls[index] == compareNum:
43+
found = True
44+
break
45+
index += 1
46+
47+
if not found:
48+
# print(not found)
49+
ls.append(compareNum)
50+
51+
# print(ls)
52+

0 commit comments

Comments
 (0)