Hi, 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: ") message=name output=name for i in range(len(message)): print"The value of message[i] is ", message[i] output=output+name+ord(message[i]) print"The value of the message is ", output checksum=(output)%256 print"The checksum is ", checksum main() 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."
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor