Re: [Tutor] Recursive user input collection problem

2009-10-15 Thread Alan Gauld
"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

Re: [Tutor] Recursive user input collection problem

2009-10-15 Thread William Witteman
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

Re: [Tutor] Recursive user input collection problem

2009-10-15 Thread Dave Angel
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

Re: [Tutor] Recursive user input collection problem

2009-10-14 Thread William Witteman
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

Re: [Tutor] Recursive user input collection problem

2009-10-14 Thread Lie Ryan
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,

Re: [Tutor] Recursive user input collection problem

2009-10-13 Thread Alan Gauld
"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

Re: [Tutor] Recursive user input collection problem

2009-10-13 Thread Dave Angel
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

Re: [Tutor] Recursive user input collection problem

2009-10-13 Thread christopher . henk
> 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

Re: [Tutor] Recursive user input collection problem

2009-10-13 Thread Weidner, Ronald
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

[Tutor] Recursive user input collection problem

2009-10-13 Thread William Witteman
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