0

why is output Do not Drive instead of Drive

https://code.sololearn.com/cccP5E97dHsB

9th Jun 2022, 8:06 PM
Khalif Baby👶
Khalif Baby👶 - avatar
2 Réponses
+ 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.
9th Jun 2022, 8:13 PM
Jayakrishna 🇮🇳
+ 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'
10th Jun 2022, 6:27 AM
A͢J
A͢J - avatar