In the first For Loop below, the code successfully shifts the letters num places to the right. The issue is in the second For Loop, it doesn't reverse it completely like it's supposed to. I've included output below. Any advice would be appreciated. Thanks
def cipher(message):
num = int(input())
final = []
finalReverse = []
for i in message:
if i.isalpha():
i = chr(ord(i)+num)
final.append(i)
if not i.isalpha():
final.append(i)
final = ''.join(map(str, final))
print(final)
for i in final:
if chr(ord(i)-num).isalpha:
x = chr(ord(i)-num)
finalReverse.append(x)
if not chr(ord(i)).isalpha:
finalReverse.append(char(ord(i)))
finalReverse = ''.join(map(str, finalReverse))
print(finalReverse)
cipher("The New York Times is in New York City.")
OUTPUT: (i entered number 3 for num)
1st For Loop's Output: Wkh Qhz \run Wlphv lv lq Qhz \run Flw||.
2nd For Loop's Output: TheNewYYorkTimesisinNewYYorkCityy+
Expected 2nd For Loop's Output: The New York Times is in New York City.