Python Programming - Operators - Discussion

Discussion Forum : Operators - General Questions (Q.No. 12)
12.
What is the output of the following code?
a = 5
b = 3
c = 7
print(a + b * c)
26
56
22
36
Answer: Option
Explanation:
The multiplication operator has higher precedence than the addition operator, so b * c is evaluated first and then added to a.
a + b * c
= 5 + 3 * 7
= 5 + 21
= 26
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.