-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfor and while loops.py
80 lines (65 loc) · 1.1 KB
/
for and while 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#FORLOOPS
tno=int(input("Enter table no"))
trange=int(input("Enter table range"))
for i in range (1,trange+1):
print (tno,"*",i,"=",tno*i)
X="NED SECTION A"
for i in X:
print(i)
l1=["apple","mango","banana"]
for i in l1:
print(i)
for i in range (10):
print(i)
for i in range(1,21):
print(i)
for i in range(1,20,2):
print(i)
for i in range (0,20,2):
print (i)
#a
for i in range(11,42,5):
print(i,"\t",end="")
print("\n")
#b
for i in range(3,34,5):
print(i,"\t",end="")
print("\n")
#c
for i in range(20,10,-3):
if i==11:
print(i)
else:
for j in range(2):
print(i,"\t",end="")
#WHILE LOOPS
tno=int(input("Enter table no"))
trange=int(input("Enter table range"))
i=1
while(i<=trange):
print(tno,"*",i,"=",tno*i)
i=i+1
#CONTINUE AND BREAK
i=0
while(i<=10):
if(i==5):
break
print(i)
i=i+1
i=0
while (i<=10):
i=i+1
if(i==8):
continue
print(i,end='')
x="Good Morning"
for i in x:
if(i=='M'):
continue
else:
print(i)
# Printing Odd No's
i=1
while(i<=100):
print(i)
i = i + 2