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
>>>
PythonnohtyP
>>>
Enter String :Test
TesttseT
>>>
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.
In the book it's written input string is 'Test'
ReplyDeleteOk, I have written it.
DeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )