<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Thanks for your response. Please always reply-all so a copy goes to
    the tutor list. I'm cc'ing this to that list.<br>
    <br>
    On 2/19/2012 10:13 AM, Deborah Knoll wrote:
    <blockquote cite="mid:BLU137-W2683F987AA4EB837F52BB8C1610@phx.gbl"
      type="cite">
      <style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
      <div dir="ltr">
        This is&nbsp; for a&nbsp;class - I wasn't&nbsp;trying to hide that fact.
        I&nbsp;didn't want someone to write this for me,</div>
    </blockquote>
    <br>
    I understand and appreciate that. I was commenting more to the other
    list responders.<br>
    <blockquote cite="mid:BLU137-W2683F987AA4EB837F52BB8C1610@phx.gbl"
      type="cite">
      <div dir="ltr"> just give some help so I could learn, which I did
        get. As for this being too advanced, it's a beginner&nbsp;Program
        Logic course and I think the code is suppose to be written
        fairly simply</div>
    </blockquote>
    Something got derailed - the question you posed requires prior
    learning; your attempts don't show that you had that learning.<br>
    <blockquote cite="mid:BLU137-W2683F987AA4EB837F52BB8C1610@phx.gbl"
      type="cite">
      <div dir="ltr"> -&nbsp;it's an online course which makes it harder&nbsp;but
        I am learning. </div>
    </blockquote>
    Would you provide a link to the course so we could see it? <br>
    <blockquote cite="mid:BLU137-W2683F987AA4EB837F52BB8C1610@phx.gbl"
      type="cite">
      <div dir="ltr">I&nbsp;didn't know of your policy but&nbsp;from now on I will
        keep it to&nbsp;more simple quesions instead of the whole program. <br>
      </div>
    </blockquote>
    That's always a good idea. Your program wasn't that big. But there
    was so much "wrong" with it - that made me question the relevance of
    the assignment.<br>
    <blockquote cite="mid:BLU137-W2683F987AA4EB837F52BB8C1610@phx.gbl"
      type="cite">
      <div dir="ltr">
        I do want to say thanks to everyone for the help -&nbsp;I'm excited
        to be learning more.<br>
      </div>
    </blockquote>
    <br>
    I like hearing that. Please also note that we like to see our
    answers interspersed with your comments. Please do the same when
    replying to us. Also delete any part of the email to which you reply
    that is not relevant to your reply. And please reply. We actually
    enjoy helping.<br>
    <br>
    Some "generic" comments:<br>
    <br>
    1) when working with a fixed-lengthobject (e.g.a list of length 7)
    start by defining a constant and then refer to that constant. e.g.:<br>
    SIZE = 7<br>
    amounts = [0]*SIZE<br>
    <br>
    2) when obtaining user input that should be a numberbut might not it
    is essential that you (in one of several ways) anticipate and handle
    "bad" input. One way is to use isdigit() to ensure that all the
    characters entered are digits. This assumes that inputs with a
    decimal point are not allowed, but your problem does not rule them
    out - it's just harder to detect "bad" input if decimal points are
    allowed. So let's assume integers only for now. Let's create a
    function whose job is to get an integer and keep trying till the
    user enters one. We might as well throw in the range check as this
    is the best place to do that.<br>
    <br>
    def getInteger():<br>
    &nbsp; while True: # this keeps asking for in put until user get it right<br>
    &nbsp;&nbsp;&nbsp; x = raw_input ("Enter an integer amount between 1 and 1000: ") #
    spell out all the requirements<br>
    &nbsp;&nbsp;&nbsp; if x.isdigit():<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; y = int(x)<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if y &gt;= 1 and y &lt;= 1000:<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return y<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else:<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print(x + " is not between 1 and 1000")<br>
    &nbsp;&nbsp;&nbsp; else:<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print(x + " is not an integer")<br>
    print getInteger()<br>
    <br>
    I wrote this as a stand-alone program so I could test it by itself,
    and added the last line to actually run the test.<br>
    <br>
    Once the getInteger function is working then you can add the other
    logic.<br>
    <br>
    Another approach is using try and except as others have mentioned.
    However I doubt whether your course has introduced exception
    handling.<br>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Bob Gailer
919-636-4239
Chapel Hill NC</pre>
  </body>
</html>