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

I am learning python atm and i cannot seem to find the problem

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 4
Thread images: 1

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


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

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
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.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.