You are on page 1of 2

Q-ANY THREE QUESTION OF IF.

1-GREATER NO. AMONG 3 NO. WRITE A PROGRAM?


Sol- a=int(input("enter the value of a"))
b=int(input("enter the value of b"))
c=int(input("enter the value of c"))
if a>b:
if a>c:
print("greater value is a")
else:
print("greater value is c")
else:
if b>c:
print("greater value is b")
else:
print("greater value is c")

Q-WRITE A PROGRAM TO INPUT THE DIGIT AND FIND THEIR SUM UNTILL USER INPUT ZERO.
Sol-c=0
a=1
while a>0:
b=int(input("enter a value"))
c=c+b
if b==0:
print("the sum of no.",c)

Q-WRITE A PROGRAM TO INPUTONE NO. AND CHECK THAT IS PALAMDROME OR NOT?


Sol-a=int(input("enter a value"))
b=a
rev=0
while(a>0):
r=-a/10
rev=rev*1
a=int(a/10)
if(b==rev):
print("the no. is paladrome")
else:
print("the no. is not palandrome")

Q-WRITE ANY 2 PYRAMID QUESTIONS.


1-
for i in range(1,6):
for j in range(i,0,-1):
print(j,end=' ')
print()
2-
for i in range(5,0,-1):
for j in range(i,0,-1):
print(j,end=' ')
print()

Q-WRITE ANY 2 QUESTIONS OF FUNCTION.


1-FROM THE PROGRAM CODE GIVEN BELOW,IDENTIFY THE PARTS MENTIONED BELOW.
Sol-def process no.(x):
x=72
return x+3
y=54
res=process no.(y)

2-WRITE THE OUTPUT OF THE FOLLOWING PYTHON CODE.


Sol-def update(x=10):
x+=15
print('x=',x)
x=20
update()
print('x=',x)

Q-WRITE ANY 2 QUESTIONS OF ITTERATION.


1.FIND THE GREATER AND LOWER VALUE?
Sol-a=int(input("enter the value"))
g=a
l=a
for i in range(9):
a=int(input("enter the value"))
if a>g:
g=a
if

You might also like