Answer to Question #245051 in Python for Raju

Question #245051

Replacing Characters of Sentence

You are given a string S,write a program to replace each letter of the string with the next letter that comes in the English Alphabet.


1
Expert's answer
2021-09-30T15:29:23-0400
s = input()
new_s = ""
for c in s:
	if c.lower() != c.upper():
		if c == 'z':
			new_s += 'a'
		elif c == 'Z':
			new_s += 'A'
		else:
			new_s += chr(ord(c)+1)
	else:
		new_s += c
print(new_s)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS