Explanation:
๐น Step 1: Understand Boolean Values in Python
In Python, booleans are treated like integers:
True = 1
False = 0
๐น Step 2: Replace Boolean with Integer Values
print(1 + 0 * 5)
๐น Step 3: Follow Operator Precedence
Python follows BODMAS/PEMDAS
Multiplication (*) happens before addition (+)
So:
0 * 5 = 0
๐น Step 4: Perform Addition
1 + 0 = 1
๐น Step 5: Final Output
print(1)
๐ Output:
1

0 Comments:
Post a Comment