<div class="gmail_quote">On Wed, Mar 23, 2011 at 9:55 AM, Lezlie Kline <span dir="ltr">&lt;<a href="mailto:lezlie.kline@gmail.com">lezlie.kline@gmail.com</a>&gt;</span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">Tony,<br><br>For your question &quot;What&#39;s the checksum for a completely empty message (i.e., no characters at all)?&quot; Do you mean the value or how do I write it?  I would think the value would be 0.<br>
</blockquote>
<div>Correct. Now think of that as your starting point; any message containing characters is going to start at 0 plus the sum of the ASCII values of each of its characters. Where would you store the initial value of an empty message?</div>

<div> </div>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">My understanding of where I&#39;m storing the ASCII values for each letter is ord(message[i])<br></blockquote>

<div>ord isn&#39;t a variable, it&#39;s a function. It&#39;s calculating the ASCII value of the i-th character of &quot;message&quot;.</div>
<div> </div>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">I don&#39;t think it&#39;s been initialized properly, but that&#39;s where I don&#39;t understand about the accumulator for strings.  I originally thought this for the accumulator:<br>
<br>output=&quot;&quot;<br>for i in range(len(message[i])&quot; 
<div class="im"><br>    print&quot;The value of message[i] is &quot;, message[i]<br></div>    output=output+&quot; &quot; + ord(message[i]) 
<div class="im"><br>    print&quot;The value of the message is &quot;, output<br><br></div>but strings and integers don&#39;t concatentate AND my ord(value) isn&#39;t accumulating AND I thing my output is getting overwritten. <br>
</blockquote>
<div>You don&#39;t want to mix apples and oranges. Your variable &quot;message&quot; contains a full name in the test case, &quot;John X. Doe&quot;, for example, so it&#39;s made up of characters. What should the accumulator contain, if you&#39;re going to be adding numbers?</div>

<div> </div>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">Here&#39;s part of the problem.  The person &quot;teaching&quot; me Python provides some information and then jumps to the programs so I&#39;m struggling in the fuzzy dark.  I was given the range &quot;for i in range(len(message[i]):print&quot;The value of message[i] is &quot;, message[i]&quot;  and I understand that it obtains the length of my message, but I don&#39;t really understand the [i] part other than [i] represents integer and the &quot;i&quot; in for i is the iteration of the loop so when you ask the question &quot;message[i] will provide you the character at position i. What are you doing with it?&quot; I&#39;m not sure what you&#39;re asking?<br>
<br>I&#39;m sorry to be so dense.  Believe it or not I&#39;ve been working on this program for a week....<br><font color="#888888"><br>L.</font> </blockquote>
<div> </div>
<div>Is this homework?</div>
<div> </div>
<div>Tony R.</div>
<div> </div>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div>
<div class="h5">
<div class="gmail_quote">On Wed, Mar 23, 2011 at 9:30 AM, taserian <span dir="ltr">&lt;<a href="mailto:taserian@gmail.com" target="_blank">taserian@gmail.com</a>&gt;</span> wrote:<br>
<blockquote style="BORDER-LEFT: rgb(204,204,204) 1px solid; MARGIN: 0pt 0pt 0pt 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div class="gmail_quote">
<div>On Wed, Mar 23, 2011 at 9:09 AM, Lezlie Kline <span dir="ltr">&lt;<a href="mailto:lezlie.kline@gmail.com" target="_blank">lezlie.kline@gmail.com</a>&gt;</span> wrote:<br>
<blockquote style="BORDER-LEFT: rgb(204,204,204) 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">Hi,<br><br>I&#39;m trying to work out the bugs in a program for calculating the checksum (modulo 256) of an input string.  I&#39;m testing it with my full name and I&#39;m a beginner with Python.  Here&#39;s what I have so far.<br>
<br>def main():<br>    print&quot;This program creates a checksum for a message.&quot;<br>    name=raw_input(&quot;Please enter the message to encode: &quot;)<br>    message=name<br>    output=name<br>    for i in range(len(message)):<br>
        print&quot;The value of message[i] is &quot;, message[i]<br>        output=output+name+ord(message[i])<br>        print&quot;The value of the message is &quot;, output<br>    checksum=(output)%256<br>    print&quot;The checksum is &quot;, checksum<br>
     <br>main()<br></blockquote></div>
<div>I&#39;d like to give you some pointers so you can solve it yourself:</div>
<div> </div>
<div>What&#39;s the checksum for a completely empty message (i.e., no characters at all)?</div>
<div>Where are you storing the (ASCII) values of each letter? Has it been initialized properly?</div>
<div>
<div> </div>
<blockquote style="BORDER-LEFT: rgb(204,204,204) 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">I know I&#39;m offbase somewhere, but I&#39;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:<br>
<br>print message<br>get input<br>find length<br>using length in range function accumulate ASCII numbers<br>calculate checksum<br>print checksum<br><br>I&#39;d appreciate any help offered as I&#39;m &quot;pulling out my hair.&quot;</blockquote>

<div> </div></div>
<div>message[i] will provide you the character at position i. What are you doing with it?</div>
<div> </div>
<div>Tony R.</div></div></blockquote></div><br></div></div></blockquote></div><br>