Class 11
Class 11
f=0
s=1
print(f)
print(s)
for i in range(1,19):
t=f+s
print(t)
f,s=s,t
Write a program to print :
1
13
135
1357
n=10
for i in range(1,n,2):
for j in range(1,i,2):
print(j, end =“ “)
print()
Write logical expressions for the following statements in
python:
a) The sum of 20 and -10 is less than 12
b) 6.75 is between the values of integers num1 and num2
c) The string ‘middle’ is larger than the string ‘first’ and
smaller than the string ‘last’
a) (20+(-10)) <12
b) (6.75 >= num1) and (6.75 <= num2)
c) (middle >first) and (middle <last)
Rewrite the following code in python after removing all syntax error(s).
Underline each correction done in the code.
a=int[“enter value of a:”]
for in range(4, 20,2)
if a=b
print "Equal Numbers”
else:
print ("Not Equal Numbers”)
Convert the following while loop into for loop.
num=7
while (num<22):
print (num*2)
num+=3