write a program that reads a string and then print it a follows:-
input string:- this is a pen
output string :- uijt$jt$jtb$b$qfo
in ( python language) please
Answers
Answered by
4
write a program that reads a string and then print it a follows:-
input string:- this is a pen
output string :- uijt$jt $b$qfo
Character after t = u
Character after h = i
Character after i = j
Character after s = t
Now, space is replaced by dollar.
We shall use this logic to solve the problem.
Now, a problem arises,
If the character is z then the next character '~' will be printed.
We can replace ~ with a.
s=input("Enter a String")
l=len(s)
for j in range (0,l):
if(s[j]==' ')
s[j]='$'
elif (s[j]=='z')
s[j]='a'
elif (s[j]=='Z')
s[j]='A'
elif (s[j]>='a' and s[j]<'z' and s[j]>='A' and s[j]<'Z')
s[j] = ord(s[j])+1
print(s)
Similar questions
Social Sciences,
3 months ago
Hindi,
3 months ago
Math,
6 months ago
Physics,
10 months ago
Economy,
10 months ago