Python Programming - Tricky Questions - Discussion

Discussion Forum : Tricky Questions - General Questions (Q.No. 12)
12.
What will be the output of the following Python code?
def func(x, y, z):
    return x + y * z

result = func(1, 2, 3)
print(result)
9
7
8
1
Answer: Option
Explanation:
The multiplication has higher precedence than addition, so the result is 1 + (2 * 3) = 7.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.