Parentheses override the order of evaluation.
def andor6(val1, val2, val3):
result = val1 and (val2 or val3)
return result
Function Call | Return Value | |||
---|---|---|---|---|
andor6(True, True, True) | → | |||
andor6(True, True, False) | → | |||
andor6(True, False, True) | → | |||
andor6(True, False, False) | → | |||
andor6(False, True, True) | → | |||
andor6(False, True, False) | → | |||
andor6(False, False, True) | → | |||
andor6(False, False, False) | → |
Experiment with this code on Gitpod.io