You are given a sentence Nice day Write a program to replace each letter with the previous letter in the english alphabet
sentence = input()
new_sentence = ""
for ch in sentence:
if ord(ch) == 122:
new_sentence += chr(97)
elif ord(ch) == 90:
new_sentence += chr(65)
elif (ord(ch) >= 97 and ord(ch) < 122) or (ord(ch) >= 65 and ord(ch) < 90):
new_sentence += chr(ord(ch)+1)
else:
new_sentence += ch
print(new_sentence)
#This code considered by expert Umed
Comments
Leave a comment