Class12 Python Questions
Class12 Python Questions
Class12 Python Questions
Q2. Rewrite the following program after finding and correcting syntactical errors and
underlining it.
a, b = 0
if (a = b)
a +b = c
print( z)
Q3. Rewrite the following code in python after removing all syntax error(s). Underline
each correction done in the code.
250 = Number
WHILE Number<=1000:
if Number=>750
print (Number)
Number=Number+100
else
print( Number*2)
Number=Number+50
Q4. Rewrite the following code in python after removing all syntax error(s). Underline
each correction done in the code.
Val = int(rawinput("Value:"))
Adder = 0
for C in range(1,Val,3)
Adder+=C
if C%2=0:
Print (C*10)
Else:
print (C*)
print (Adder)
Q5. Rewrite the following code in python after removing all syntax error(s). Underline
each correction done in the code.
25=Val
for I in the range(0,Val)
if I%2==0:
print( I+1)
Else:
print (I‐1
Q6. Rewrite the following code in python after removing all syntax error(s). Underline
each correction done in the code.
STRING=""WELCOME
NOTE""
for S in range[0,8]:
print (STRING(S))
Q7. Rewrite the following code in python after removing all syntax error(s). Underline
each correction done in the code.
a=int{input("ENTER FIRST NUMBER")}
b=int(input("ENTER SECOND NUMBER"))
c=int(input("ENTER THIRD NUMBER"))
if a>b and a>c
print("A IS GREATER")
if b>a and b>c:
Print(" B IS GREATER")
if c>a and c>b:
print(C IS GREATER)
Q8. Rewrite the following code in python after removing all syntax error(s). Underline
each correction done in the code.
i==1
a=int(input("ENTER FIRST NUMBER"))
FOR i in range[1, 11];
print(a,"*=", i ,"=",a * i)
Q9. Rewrite the following code in python after removing all syntax error(s). Underline
each correction done in the code.
a=”1”
while a>=10:
print("Value of a=",a)
a=+1
Q10. Rewrite the following code in python after removing all syntax error(s). Underline
each correction done in the code.
Num=int(rawinput("Number:"))
sum=0
for i in range(10,Num,3)
Sum+=1
if i%2=0:
print(i*2)
Else:
print(i*3 print Sum)
Q11. Rewrite the following code in python after removing all syntax error(s). Underline
each correction done in the code.
weather='raining'
if weather='sunny':
print("wear sunblock")
elif weather='snow':
print("going skiing")
else:
print(weather)
Q12. Write the modules that will be required to be imported to execute the following
code in Python.
def main( ):
for i in range (len(string)) ):
if string [i] = = ‘’ “
print
else:
c=string[i].upper()
print( “string is:”,c)
print (“String length=”,len(math.floor()))
Q13. Observe the following Python code very carefully and rewrite it after removing all
syntactical errors with each correction underlined.
DEF execmain():
x = input("Enter a number:")
if (abs(x)=x):
print ("You entered a positive number")
else:
x=*‐1
print "Number made positive:"x
execmain()
Q14. Rewrite the following code in python after removing all syntax error(s).Underline
each correction done in the code
x=integer(input('Enter 1 or 10'))
if x==1:
for x in range(1,11)
Print(x)
Else:
for x in range(10,0,‐1):
print(x)
Q15. Rewrite the following code in python after removing all syntax error(s). Underline
each correction done in the code.
30=To
for K in range(0,To)
IF k%4==0:
print (K*4)
else
print (K+3)
Q11. Find and write the output of the following python code :
def Changer(P,Q=10):
P=P/Q
Q=P%Q
print P,"#",Q
return P
A=200
B=20
A=Changer(A,B)
print A,"$",B
B=Changer(B)
print A,"$",B
A=Changer(A)
print A,"$",B
Q12. Find and write the output of the following python code:
Data = ["P",20,"R",10,"S",30]
Times = 0
Alpha = ""
Add = 0
for C in range(1,6,2):
Times= Times + C
Alpha= Alpha + Data[C‐1]+"$"
Add = Add + Data[C]
print Times,Add,Alpha
Q13. Find and write the output of the following python code:
Text1="AISSCE 2018"
Text2=""
I=0
while I<len(Text1):
if Text1[I]>="0" and Text1[I]<="9":
Val = int(Text1[I])
Val = Val + 1
Text2=Text2 + str(Val)
elif Text1[I]>="A" and Text1[I] <="Z":
Text2=Text2 + (Text1[I+1])
else:
Text2=Text2 + "*"
I=I+1
print Text2
Q14. Find and write the output of the following python code:
TXT = ["20","50","30","40"]
CNT = 3
TOTAL = 0
for C in [7,5,4,6]:
T = TXT[CNT]
TOTAL = float (T) + C
print TOTAL
CNT‐=1
2. t2=("sun","mon","tue","wed","thru","fri")
for i in range (‐6,2):
print(t2[i])
3. t3=("sun","mon","tue","wed","thru","fri")
if "sun" in t3:
for i in range (0,3):
print(t2[i])
else:
for i in range (3,6):
print(t2[i])
6. t6=('a','b')
t7=('p','q')
t8=t6+t7
print(t8*2)
7. t9=('a','b')
t10=('p','q')
t11=t9+t10
print(len(t11*2))
8. t12=('a','e','i','o','u')
p, q, r, s, t=t12
print("p= ",p)
print("s= ",s)
print("s + p", s + p)
9. t13=(10,20,30,40,50,60,70,80)
t14=(90,100,110,120)
t15=t13+t14
print(t15[0:12:3])
2. t1=(10,20,30,40,50,60,70,80)
i=t1.len()
Print(T1,i)
3. t1=(10,20,30,40,50,60,70,80)
t1[5]=55
t1.append(90)
print(t1,i)
4. t1=(10,20,30,40,50,60,70,80)
t2=t1*2
t3=t2+4
print t2,t3
5. t1=(10,20,30,40,50,60,70,80)
str=””
str=index(t1(40))
print(“index of tuple is ”, str)
str=t1.max()
print(“max item is “, str)