Professional Documents
Culture Documents
i.sqrt()
ii.dump()
iii.Uniform()
iv.fabs()
22. How many times will Python execute the code inside the following while loop?
i=1
while i < 10000 and i > 0:
print ("Hello ...")
i=2*i
23. Convert the following for loop into while loop,
for i in range (1,100):
if i % 4 == 2 :
print ( i,"mod", 4 , "= 2")
24. Convert the following while loop into for loop:
i=0
while i < 100:
if i % 2 == 0:
print (i, "is even")
else:
print(i, "is odd")
i =i+1
25. Write for statement to print the series 105, 98, 91,….7
26. Give the output of the following
i) num=100.2
perc=num
print (int(perc))
27. How many times will the following for loop execute and what’s the output?
i) for i in range(-1,7,-2):
for j in range(3):
print(i,j)
ii)for i in range(1,3,1):
for j in range(i+1):
print(‘*’)
28. Predict the output of the following codes:
i) x=10
y=5
for i in range(x-y*2):
print(“%”,i)
ii) x=10
y=0
while x>y:
print(x,y)
x=x-1
y=y+1