python
Given:
age1 = 21 age2 = 14 age3 = 15
Simplify the following expression to true or false:
age1 > age3 and not(age3 == 15) or age3 > age2
Step 1) Substitute in the values
Step 2) Evaluate all the relational operators (<, >, <=,
>=, ==, !=) to true or false
Step 3) Evaluate the boolean (logical) operator (and, or, not) of
highest precedence
Step 4) Evaluate the next boolean (logical) operator (and, or, not)
of highest precedence
Step 5) Show the final answer by evaluating the remaining (boolean)
logical operator.
Please upvote this answer if it helped. Thanks and stay safe.
Explanation :
NOT |
HIGH |
AND |
MEDIUM |
OR |
LOW |
here,
not(age3 == 15) is FALSE
age1 > age3 is TRUE
age3 > age2 is TRUE
if 1 is true and 0 is false:
so (1 and 0) becomes 0
now, (1 or 0) becomes 1
hence the final result is TRUE
Feel free to ask doubts and please upvote. Thanks.
Get Answers For Free
Most questions answered within 1 hours.