Re: Problem I have with a while loop/boolean/or

2007-03-15 Thread Gabriel Genellina
En Wed, 14 Mar 2007 15:34:20 -0300, Fabio FZero <[EMAIL PROTECTED]> escribió: > Why don't you try this instead: > > hint = raw_input("\nAre you stuck? y/n: ") > hint = hint.lower() > > while not hint in 'yn': > hint = raw_input("Please specify a valid choice: ") Dangerous: what if the user

Re: Problem I have with a while loop/boolean/or

2007-03-14 Thread Fabio FZero
On Mar 13, 7:34 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi all. > > I have a problem with some code :( > > --- > > hint = raw_input("\nAre you stuck? y/n: ") > hint = hint.lower() > > while (hint != 'n') or (hint != 'y'): > hint = raw_input("Please specify a valid choice: "

Re: Problem I have with a while loop/boolean/or

2007-03-14 Thread [EMAIL PROTECTED]
On Mar 13, 5:34 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi all. > > I have a problem with some code :( > > --- > > hint = raw_input("\nAre you stuck? y/n: ") > hint = hint.lower() > > while (hint != 'n') or (hint != 'y'): > hint = raw_input("Please specify a valid choice: "

Re: Problem I have with a while loop/boolean/or

2007-03-14 Thread Steve Holden
Scott David Daniels wrote: > Bart Willems wrote: >> ... >> I always try to stay away from 'negative' operators if possible, to >> improve readability: >> >> while True: >>hint = raw_input('\nAre you stuck? y/n: ').lower() >>if hint = 'y' or hint = 'n': >> break >>else: >> p

Re: Problem I have with a while loop/boolean/or

2007-03-13 Thread Scott David Daniels
Bart Willems wrote: > ... > I always try to stay away from 'negative' operators if possible, to > improve readability: > > while True: >hint = raw_input('\nAre you stuck? y/n: ').lower() >if hint = 'y' or hint = 'n': > break >else: > print 'Please answer yes or no' And if

Re: Problem I have with a while loop/boolean/or

2007-03-13 Thread hg
hg wrote: > [EMAIL PROTECTED] wrote: > >> Hi all. >> >> I have a problem with some code :( >> >> --- >> >> hint = raw_input("\nAre you stuck? y/n: ") >> hint = hint.lower() >> >> while (hint != 'n') or (hint != 'y'): >> hint = raw_input("Please specify a valid choice: ") >> >> --

Re: Problem I have with a while loop/boolean/or

2007-03-13 Thread hg
[EMAIL PROTECTED] wrote: > Hi all. > > I have a problem with some code :( > > --- > > hint = raw_input("\nAre you stuck? y/n: ") > hint = hint.lower() > > while (hint != 'n') or (hint != 'y'): > hint = raw_input("Please specify a valid choice: ") > > --

Re: Problem I have with a while loop/boolean/or

2007-03-13 Thread Bart Willems
John McMonagle wrote: > Try it a different way: > > while True: > hint = raw_input("\nAre you stuck? y/n: ") > hint = hint.lower() > if hint != 'y' and hint != 'n': > print "Please answer y or n" > continue > else: > break > if hint == 'y': > do_your_hin

Re: Problem I have with a while loop/boolean/or

2007-03-13 Thread John McMonagle
[EMAIL PROTECTED] wrote: > Hi all. > > I have a problem with some code :( > > --- > > hint = raw_input("\nAre you stuck? y/n: ") > hint = hint.lower() > > while (hint != 'n') or (hint != 'y'): > hint = raw_input("Please specify a valid choice: ") > > ---

Re: Problem I have with a while loop/boolean/or

2007-03-13 Thread [EMAIL PROTECTED]
On Mar 13, 10:50 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Hi all. > > > I have a problem with some code :( > > > --- > > > hint = raw_input("\nAre you stuck? y/n: ") > > hint = hint.lower() > > > while (hint != 'n') or (hint != 'y'): > > hint = raw_input

Re: Problem I have with a while loop/boolean/or

2007-03-13 Thread [EMAIL PROTECTED]
On Mar 13, 10:43 pm, Paul Rubin wrote: > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > > while (hint != 'n') or (hint != 'y'): > > hint = raw_input("Please specify a valid choice: ") > > > - > > > so everytime I run the

Re: Problem I have with a while loop/boolean/or

2007-03-13 Thread Larry Bates
[EMAIL PROTECTED] wrote: > Hi all. > > I have a problem with some code :( > > --- > > hint = raw_input("\nAre you stuck? y/n: ") > hint = hint.lower() > > while (hint != 'n') or (hint != 'y'): > hint = raw_input("Please specify a valid choice: ") > > ---

Re: Problem I have with a while loop/boolean/or

2007-03-13 Thread Paul Rubin
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > while (hint != 'n') or (hint != 'y'): > hint = raw_input("Please specify a valid choice: ") > > - > > so everytime I run the program, and enter my choice as y or n, I'm > told to 'Please Specify a va

Problem I have with a while loop/boolean/or

2007-03-13 Thread [EMAIL PROTECTED]
Hi all. I have a problem with some code :( --- hint = raw_input("\nAre you stuck? y/n: ") hint = hint.lower() while (hint != 'n') or (hint != 'y'): hint = raw_input("Please specify a valid choice: ") - so everytime I run the program, and