0% found this document useful (0 votes)
36 views6 pages

Class 11

Tmkc

Uploaded by

trdyrx7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views6 pages

Class 11

Tmkc

Uploaded by

trdyrx7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Write a python program to check whether number entered

by the user is a palindrome or not.

n=int(input(“Enter the number:”))


num = n
rev=0
while(n>0):
dig=n%10
rev=rev*10 + dig
n=n//10
if(num==rev):
print(“Number is palindrome”)
else:
print(“Number is not palindrome”)
Write a program to print the Fibonacci series of first 20 elements

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

for num in range(7,21,3):


print (num*2)

You might also like