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.
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?
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Comments