0
why is output Do not Drive instead of Drive
2 odpowiedzi
+ 11
It should be like
if age == 18 and name == "Jerry" : # correct way
like this, same for next condition..
hope you can correct it now.
+ 2
KB Is 🅿️
name is a string and 18 is a number
So name == 18 -> False
if age:
if you don't compare age and directly write like this output will be always True because age is declared
Same "Jerry" -> True
So True and False and True -> False
---------
if age and name == 118 or "mink":
here if age -> True
name == 118 -> False
so True and False -> False
now "mink" -> True
so False or True -> True
So output is -> Do not Drive
So elif condition should be:
elif age == 118 or name == 'mink'