Help please

Chris Angelico rosuav at gmail.com
Mon Apr 1 01:24:52 EDT 2013


On Mon, Apr 1, 2013 at 4:15 PM,  <khaosyt at gmail.com> wrote:
>     integer = input("Enter a positive integer: ")
>     again = raw_input("Again? (Y/N): ")

Okay, the first thing I'm going to say is: Don't use input() in Python
2. It's dangerous in ways you won't realize. Use int(raw_input(...))
for something like this, which will guarantee you an integer.

I'm guessing this is homework. Please be honest about that; we'll help
you learn but won't just give you the answers.

All you need to do is initialize something to zero, and then keep
adding 'number' onto it in the loop. You should be able to sort that
out.

ChrisA



More information about the Python-list mailing list