[Tutor] Question about if functions

Steven D'Aprano steve at pearwood.info
Fri Aug 22 17:25:38 CEST 2014


On Fri, Aug 22, 2014 at 02:43:20AM +0000, Mimi Ou Yang wrote:

> if (name and age == jimmy and 35):
>     print ("BLABLABLABLABLABLAB") 

if name == 'jimmy' and age == 35:
    print("BLAB")

or if you prefer:

if (name, age) == ("jimmy", 35):
    print("BLAB")

Take careful note that strings like "jimmy" have to be quoted, otherwise 
Python will look for a variable jimmy.



-- 
Steven


More information about the Tutor mailing list