Advertisements
Advertisements
Question
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)Very Short Answer
Advertisements
Solution
QP-^14
shaalaa.com
Is there an error in this question or solution?
