3 Réponses
+ 15
You input numbers, which all evaluate to True if they're not zero.
Expressions with 'and' or 'or' return the last value checked. And the checking stops as soon as a result is found (in your case always True).
'Or' asserts that only one of the given values is True, so in the 'or' phrases already the first number is returned.
'and' phrases need to make sure that ALL values are True, so you get the second value in your examples.
+ 2
Truth table for AND operator:
A B Output
T F False
T T True
F T False
F F False
Truth table for OR Operator
A B Output
T T True
T F True
F T True
F F False
T stands for True and F stands for False.. Just take a look at this you will get some idea..
+ 2
In AND operation if 1st variable is true then only it will check for 2nd one .....if 1st variable only false I give direct output false