First, it matters if it has lower or upper case. I'm going to assume here that all characters are lowercase (if they werenβt, it would be easy enough to make them)
if b>122: b=122-b
w = 119 in ASCII and z = 122 (decimal in ASCII), so 119 + 5 = 124 and 124-122 = 2, which is our new b, then we add this to a-1 (this takes care if we get 1 back, 2 + 96 = 98 and 98 - b.
To print on the same line instead of printing when you have it, I would write them to a list and then create a line from that list.
but instead
print(chr(c)) else: print(chr(b))
I would do
someList.append(chr(c)) else: somList.append(chr(b))
then combine each item in the list together on one line.
source share