while loop - multiple condition
Marko Rauhamaa
marko at pacujo.net
Sun Oct 12 15:16:56 EDT 2014
More information about the Python-list mailing list
Sun Oct 12 15:16:56 EDT 2014
- Previous message (by thread): while loop - multiple condition
- Next message (by thread): while loop - multiple condition
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Chris Angelico <rosuav at gmail.com>: > On Mon, Oct 13, 2014 at 4:59 AM, Shiva > <shivaji_tn at yahoo.com.dmarc.invalid> wrote: >> Bit confusing to use in While loop - Should have used the 'and' condition >> instead of OR- then it works fine. >> for OR both condition need to be false to produce a false output and break >> the loop. > > Correct, what you're looking for here is indeed an 'and' (also called > a conjunction, as opposed to the disjunction of 'or'). Both operators > are important; and you need to understand what they do so you know > when to use each. The corrected version while ans.lower() != 'yes' and ans.lower()[0] != 'y': ans = input('Do you like python?') is equivalent with while ans.lower()[0] != 'y': ans = input('Do you like python?') Marko
- Previous message (by thread): while loop - multiple condition
- Next message (by thread): while loop - multiple condition
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list