Question:31
A. Predict the output of the following Python code:
s1=”SQP-25″
s2=””
i=0
while i<len(s1):
if s1[i]>=’0′ and s1[i]<=’9′:
Num=int(s1[i])
Num-=1
s2=s2+str(Num)
elif s1[i]>=’A’ and s1[i]<=’Z’:
s2=s2+s1[i+1]
else:
s2=s2+’^’
i+=1
print(s2)
OR
B. Predict the output of the following Python code:
wildlife_sanctuary = [“Kaziranga”, “Ranthambhore”, “Jim Corbett”, “Sundarbans”,
“Periyar”, “Gir”, “Bandipur”]
output = [ ]
for sanctuary in wildlife_sanctuary:
if sanctuary[-1] in ‘aeiou’:
output.append(sanctuary[0].upper())
print(output)
cskc.manager| Created: 24-Mar-2026 | Updated: 26-Mar-2026|CBSE12A-2026
