This question already has an answer here:
I'm fairly new to python/programming in general and I would like to know the affect (if any) that parentheses have when using the 'or' operator.
For example what's the difference between this:
if (x or y or z) == 3:
return True
this:
if x or y or z == 3:
return True
and this:
if x == 3 or y == 3 or z == 3:
return True
I have tried using each line of code and have seen varied results making it difficult to identify what each line does. Any help would be greatly appreciated-thanks.
Aucun commentaire:
Enregistrer un commentaire