I am learning python atm and i cannot seem to find the problem in my code.
I am trying to make a program that encodes the input using a ceasarian cipher. For some reason, instead of returning the code, it just returns a blank. I have tried this several different ways, but i cannot seem to make it work.
"""Ceasar Cipher code"""
x = list(input("enter phrase to be encoded, letters and spaces only"))
y = list(map(ord,x))
n = int(input("enter ceasarian key"))
def encodeint(y):
return [32 for i in y if i == 32]
return [(i+n) for i in y if 96<i<123]
return [(i-26+n) for i in y if 122<i<149]
return [(i+26+n) for i in y if 64<i>91]
encoded = (list(map(chr,encodeint(y))))
print(y)
print(encodeint(y))
print(("").join(encoded))
each return part of the function takes into account the fact that the cipher wraps around once it reaches higher than z.
>64<i>91
You are checking if i is bigger than 64 and if it's bigger than 91.
>>55382079
i changed that afterwards, sorry lol
But the point remains. The function returns an empty list still
>>55382192
Post this in the Daily Programming Thread