Explanation:
Step 1: Understand Boolean Values
In Python, Boolean values behave like integers in arithmetic operations:
- True = 1
- False = 0
Step 2: Evaluate Addition
True + 2
- True is treated as 1.
- Therefore, 1 + 2 = 3.
Step 3: Evaluate Multiplication
3 * False
- False is treated as 0.
- Therefore, 3 * 0 = 0.
Step 4: Evaluate Final Addition
0 + 5
- Add 5 to the result.
- Final value becomes 5.
3. Final Output
5
.png)

0 Comments:
Post a Comment