"William Witteman" wrote
You need a loop, and putting a while True: around the whole thing
solves it nicely. Don't *call* the function again, just loop back
and do the operation again. That's what loops are for.
True, that's why my code currently looks like this:
Personally I don't think
On Thu, Oct 15, 2009 at 07:54:23AM -0400, Dave Angel wrote:
>William Witteman wrote:
>>Thanks to all who responded. There were several good points about the
>>code itself, all of which both helped and work.
>>
>>I will likely use Alan's example because I find it the most lucid, but
>>the other sug
William Witteman wrote:
Thanks to all who responded. There were several good points about the
code itself, all of which both helped and work.
I will likely use Alan's example because I find it the most lucid, but
the other suggestions are good signposts to other ways to do the same
thing (but r
Thanks to all who responded. There were several good points about the
code itself, all of which both helped and work.
I will likely use Alan's example because I find it the most lucid, but
the other suggestions are good signposts to other ways to do the same
thing (but right, as opposed to how I
William Witteman wrote:
> I need to collect a couple of integers from a user, but I want to make
> sure that I actually get integers. I tried this, but subsequent calls
> to the function don't update variable. I'm not sure this is terribly
> clear - here's the code:
>
>
> def getinput(variable,
"William Witteman" wrote
I want to make sure that I actually get integers.
num_of_articles = 0
num_of_reviewers = 0
def getinput(variable,prompt):
"""
Get the input by prompting the user and collecting the response - if it
is
a non-integer, try again.
"""
variable = 0
variable = ra
William Witteman wrote:
I need to collect a couple of integers from a user, but I want to make
sure that I actually get integers. I tried this, but subsequent calls
to the function don't update variable. I'm not sure this is terribly
clear - here's the code:
num_of_articles = 0
num_of_reviewer
> I need to collect a couple of integers from a user, but I want to make
> sure that I actually get integers. I tried this, but subsequent calls
> to the function don't update variable. I'm not sure this is terribly
> clear - here's the code:
>
> num_of_articles = 0
> num_of_reviewers = 0
>
> d
October 13, 2009 4:22 PM
To: tutor@python.org
Subject: [Tutor] Recursive user input collection problem
I need to collect a couple of integers from a user, but I want to make
sure that I actually get integers. I tried this, but subsequent calls
to the function don't update variable. I
I need to collect a couple of integers from a user, but I want to make
sure that I actually get integers. I tried this, but subsequent calls
to the function don't update variable. I'm not sure this is terribly
clear - here's the code:
num_of_articles = 0
num_of_reviewers = 0
def getinput(variab
10 matches
Mail list logo