At 02:12 PM 8/12/2007, Dick Moores wrote:
At 01:15 PM 8/12/2007, Khamid Nurdiev wrote:
Hello All,
 I am currently learning python with the book "Python programming: An introduction to CS" by John M. Zelle and have come the section where he speaks of encoding messages. Currently the basic snippet looks like this:

def dec():
    import string
    message=raw_input("Enter the message to decode: ")
    result=''
    for x in string.split(message):
        result=result+chr(eval(x))
    return result
print dec()


it works fine as expected

I dunno, if I enter "How are you?" at the prompt, I get "NameError: name 'How' is not defined".

Oops! I missed the meaning of "decode". Sorry.

Dick

_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to