Re: Using len()

2006-03-11 Thread Fredrik Lundh
Steven D'Aprano wrote: > I don't know why input() is the equivalent of eval(raw_input(prompt)), but > it is. Presumably Guido thought it was a good idea at the time. possibly inspired by ABC's "READ" and "READ RAW" commands: http://homepages.cwi.nl/~steven/abc/qr.html -- http://mail.py

Re: Using len()

2006-03-11 Thread Steven D'Aprano
On Sat, 11 Mar 2006 01:05:48 -0800, ctilly wrote: > That works, thanks. Can you tell me why the differences exist? For those who have just joined us, "that" is using raw_input() instead of input(). I don't know why input() is the equivalent of eval(raw_input(prompt)), but it is. Presumably Guid

Re: Using len()

2006-03-11 Thread Jonathan Gardner
Methinks you are confused about the structure of your program. If we write the program out in plain English in the form of a recipe, it should look something like this: 1. Get input. 2. Check to see if they guessed right. 3. If not, go back to 1. This structure hints at an infinite loop. The bre

Re: Using len()

2006-03-11 Thread Fredrik Lundh
Bryan Olson wrote: > Try "rawinput()" instead. or, less likely to give a NameError, raw_input() -- http://mail.python.org/mailman/listinfo/python-list

Re: Using len()

2006-03-11 Thread ctilly
That works, thanks. Can you tell me why the differences exist? -- http://mail.python.org/mailman/listinfo/python-list

Re: Using len()

2006-03-11 Thread Bryan Olson
[EMAIL PROTECTED] wrote: [...] > But I would like to change it to be something like > > while yourguess != mynum: > > tries = tries + 1 > yourguess = input("Your guess? ") > > if len(yourguess)==0: > continue [...] > But this throws the following error and I h

Using len()

2006-03-11 Thread ctilly
I have what I think is a very simple question. I have a Python script that I found that I want to tweek a little bit. All I want to do is add in a validator to make sure a value has been keyed into the imput box. The code currently is... while yourguess != mynum: tries = tries + 1