[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
I am learning python atm and i cannot seem to find the problem

You are currently reading a thread in /g/ - Technology

Thread replies: 4
Thread images: 1
File: mad.png (292 KB, 617x389) Image search: [Google]
mad.png
292 KB, 617x389
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
Thread replies: 4
Thread images: 1

[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
If a post contains illegal content, please click on its [Report] button and follow the instructions.
This is a 4chan archive - all of the content originated from them. If you need information for a Poster - you need to contact them.
This website shows only archived content and is not affiliated with 4chan in any way.
If you like this website please support us by donating with Bitcoin at 1XVgDnu36zCj97gLdeSwHMdiJaBkqhtMK