[Tutor] Checksum program

Lezlie Kline lezlie.kline at gmail.com
Wed Mar 23 14:09:53 CET 2011


I'm trying to work out the bugs in a program for calculating the checksum
(modulo 256) of an input string.  I'm testing it with my full name and I'm a
beginner with Python.  Here's what I have so far.

def main():
    print"This program creates a checksum for a message."
    name=raw_input("Please enter the message to encode: ")
    for i in range(len(message)):
        print"The value of message[i] is ", message[i]
        print"The value of the message is ", output
    print"The checksum is ", checksum


I know I'm offbase somewhere, but I'm not understanding some parts of the
accumulator part of the program.  I need it to work with the message[i]
intact.  In other words, I need the pseudo code to go something like this:

print message
get input
find length
using length in range function accumulate ASCII numbers
calculate checksum
print checksum

I'd appreciate any help offered as I'm "pulling out my hair."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110323/185e5b89/attachment.html>

More information about the Tutor mailing list