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

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -