What are the syntax for &&, ||

Tim Chase python.list at tim.thechases.com
Wed Oct 22 17:27:50 EDT 2008


> if condition1 && condition2: # and
> 	doThis
> elif condition3 || condition4: # or
> 	doThat
> 
> In most of language have &&, ||
> 
> How do I do in Python?

Heh, you answered your own question in your comments:

   if condition1 and condition2:
     doThis()
   elif cond3 or cond4:
     doThat()

-tkc






More information about the Python-list mailing list