Professional Documents
Culture Documents
Looping Test Series
Looping Test Series
● for i in "python":
print (i)
● for i in range(5):
print(i)
● for i in range(10,15):
print(i)
Q2. Write a program to print first 10 natural number.
Q9.Convert the following while loop into for loop and also find
the output.
A.x=5
while(x<15):
print(x**2)
x+=3
B.a=7
b=5
while(a<9):
print(a+b)
a+=1
C. b=5
while(b<9):
print("H")
b+=1
D. b=15
while(b>9):
print("Hello")
b=b-2
E. x=15
while(x==15):
print("Hello")
x=x-3
A.i=2
for x in range(i):
x+=1
print(x)
print(x)
B.i=2
for x in range(i):
x+=1
print(x)
print(x)
C.i=0
while i<3:
print(i)
i=i+1
print(0)
D.i=0
while i<3:
print(i)
i=i+1
print(0)
E.i=100
while i<57:
print(i)
i+=5
F.i=100
while i> 57:
print(i)
i+=5
Q.13 Write a program that keep on accepting number from the user
until user enters Zero. Display the sum and average of all the
numbers.