Q. Find the output:


(a)

S = input("Enter String :")

RS = ' '

for ch in S :

    RS = ch + RS

print(S + RS)


(b)

S = input("Enter string : ")

RS = " "

for ch in S :

    RS = ch + 2 + RS

    print (RS + S)



Answer =


(a)

Output: -

Enter String :Python
PythonnohtyP

>>>

Enter String :Test
TesttseT 

>>>


(b)

Output: - It will give an error. Error in 4 lines.

Because in line "RS = ch + 2 + RS", integer can not add with String.

2 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post