python - Creating a Caeser program: Converting ASCII to characters -


i'm working on python attempting make caeser cipher program. i've made gui platform , have been able make cipher part work, spits out message in ascii.

when run program, takes info, amount of letters want alphabet shift by, , says message in ascii, how can part come out in letters?

i tried storing loop variable adding variable common ascii --> character converter, doesn't work.

here's code:

def encode(userphrase):     msg = input('enter message: ')     key = eval(input("enter number"))     finalmsg = msg.upper()     ch in finalmsg:         print( str( ord(ch)+key ), end=' ') 

change str chr:

print( chr( ord(ch)+key ), end=' ') 

per documentation on chr:

return string representing character unicode code point integer i. example, chr(97) returns string 'a', while chr(957) returns string 'ν'. inverse of ord().


Comments

Popular posts from this blog

How to check data type in C++? -

javascript - Is getTimezoneOffset() stable during daylight saving transition? -

sql server - SQL Query returns one result, does not return 0 or NULL result -