Python Programming - Tricky Questions - Discussion

Discussion Forum : Tricky Questions - General Questions (Q.No. 39)
39.
What is the output of the following Python code?
x = 2
y = 3
result = x * y ** x
print(result)
12
18
24
8
Answer: Option
Explanation:
Exponentiation (**), performed before multiplication, results in 3 ** 2, and then multiplied by 2.
Discussion:
1 comments Page 1 of 1.

Satya Ranjan Sethy said:   1 month ago
Ans:-18
It happens due tooperator precedence

Post your comments here:

Your comments will be displayed after verification.