Re: [Tutor] While loop issue, variable not equal to var or var

2014-07-12 Thread Steven D'Aprano
On Sat, Jul 12, 2014 at 02:39:12PM +0200, Wolfgang Maier wrote: [...] > Very interesting advice. Wasn't aware at all of this feature of casefold. > As a native German speaker, I have to say that your last two examples > involving the capital ß are pretty contrived: although the capital ß is > par

Re: [Tutor] While loop issue, variable not equal to var or var

2014-07-12 Thread Alan Gauld
On 12/07/14 13:19, Steven D'Aprano wrote: Because the person might have typed any of: grosse große etc., and you want to accept them all, just like in English The bit I was missing was that a German user might use the ss version instead the ß so testing for either of them alone is insuffi

Re: [Tutor] While loop issue, variable not equal to var or var

2014-07-12 Thread Wolfgang Maier
On 12.07.2014 14:20, Dave Angel wrote: I don't remember my high school German enough to remember if the ß character is an example, but in various languages there are characters that exist only in uppercase, and whose lowercase equivalent is multiple letters. Or vice versa. And characters

Re: [Tutor] While loop issue, variable not equal to var or var

2014-07-12 Thread Wolfgang Maier
On 12.07.2014 14:19, Steven D'Aprano wrote: On Sat, Jul 12, 2014 at 11:27:17AM +0100, Alan Gauld wrote: On 12/07/14 10:28, Steven D'Aprano wrote: If you're using Python 3.3 or higher, it is better to use message.casefold rather than lower. For English, there's no real difference: ... but it ca

Re: [Tutor] While loop issue, variable not equal to var or var

2014-07-12 Thread Steve Rodriguez
Thank you guys! Works perfectly! :D Regards, Steve Rodriguez On Sat, Jul 12, 2014 at 1:21 AM, Peter Otten <__pete...@web.de> wrote: > Peter Otten wrote: > > > PS: You sometimes see > > > > message in "qQ" > > > > but this is buggy as it is true when the message is either > > "q", "Q", or "qQ".

Re: [Tutor] While loop issue, variable not equal to var or var

2014-07-12 Thread Joseph Lee
Hi Steve, In your conditionals: … while message != 'q' or 'Q'/message != “q” or message != “Q”: … Python will only match the first variable. A better approach (which might be a good solution) would be capturing the exit commands in a list like this: JL’s code: while message not in [“q”, “Q”]

Re: [Tutor] While loop issue, variable not equal to var or var

2014-07-12 Thread Dave Angel
Steven D'Aprano Wrote in message: > On Sat, Jul 12, 2014 at 09:33:20AM +0100, Alan Gauld wrote: > >> 2) Better (IMHO) is to convert message to lower case (or upper if >> you prefer) and only do one comparison: >> >> while message.lower() != 'q': > > I second this advice, but with a slight modif

Re: [Tutor] While loop issue, variable not equal to var or var

2014-07-12 Thread Steven D'Aprano
On Sat, Jul 12, 2014 at 11:27:17AM +0100, Alan Gauld wrote: > On 12/07/14 10:28, Steven D'Aprano wrote: > > >If you're using Python 3.3 or higher, it is better to use > >message.casefold rather than lower. For English, there's no real > >difference: > >... > >but it can make a difference for non-E

Re: [Tutor] While loop issue, variable not equal to var or var

2014-07-12 Thread Alan Gauld
On 12/07/14 10:28, Steven D'Aprano wrote: If you're using Python 3.3 or higher, it is better to use message.casefold rather than lower. For English, there's no real difference: ... but it can make a difference for non-English languages: py> "Große".lower() # German for "great" or "large" 'groß

Re: [Tutor] While loop issue, variable not equal to var or var

2014-07-12 Thread Steven D'Aprano
On Sat, Jul 12, 2014 at 09:33:20AM +0100, Alan Gauld wrote: > 2) Better (IMHO) is to convert message to lower case (or upper if > you prefer) and only do one comparison: > > while message.lower() != 'q': I second this advice, but with a slight modification. If you're using Python 3.3 or higher,

Re: [Tutor] While loop issue, variable not equal to var or var

2014-07-12 Thread Alan Gauld
On 11/07/14 22:16, Steve Rodriguez wrote: Hey guys n gals, New to python, having some problems with while loops, I would like to make a program quick once q or Q is typed, but thus far I can only get the first variable to be recognized. > My code looks like: > > message = raw_input("-> ")

Re: [Tutor] While loop issue, variable not equal to var or var

2014-07-12 Thread Peter Otten
Peter Otten wrote: > PS: You sometimes see > > message in "qQ" > > but this is buggy as it is true when the message is either > "q", "Q", or "qQ". Oops, I forgot "". ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription option

Re: [Tutor] While loop issue, variable not equal to var or var

2014-07-12 Thread Peter Otten
Steve Rodriguez wrote: > Hey guys n gals, > > New to python, having some problems with while loops, I would like to make > a program quick once q or Q is typed, but thus far I can only get the > first variable to be recognized. My code looks like: > > message = raw_input("-> ") > while m

[Tutor] While loop issue, variable not equal to var or var

2014-07-11 Thread Steve Rodriguez
Hey guys n gals, New to python, having some problems with while loops, I would like to make a program quick once q or Q is typed, but thus far I can only get the first variable to be recognized. My code looks like: message = raw_input("-> ") while message != 'q': s.send(message)