Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #42442
| References | <61cf6de1-179e-4d3d-8083-a2f34b144cd1@googlegroups.com> |
|---|---|
| Date | 2013-04-01 16:24 +1100 |
| Subject | Re: Help please |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4046.1364793902.2939.python-list@python.org> (permalink) |
On Mon, Apr 1, 2013 at 4:15 PM, <khaosyt@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
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Help please khaosyt@gmail.com - 2013-03-31 22:15 -0700
Re: Help please Chris Angelico <rosuav@gmail.com> - 2013-04-01 16:24 +1100
Re: Help please khaosyt@gmail.com - 2013-03-31 22:41 -0700
Re: Help please Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-02 00:09 +0000
Re: Help please khaosyt@gmail.com - 2013-03-31 22:41 -0700
csiph-web