evaluate python expression 3+4//7-8*(2**2)
Answers
Answered by
3
use precedence rule here:
(**) has highest precedence in all operator.
3 + 4 // 7 - 8*(2**2) = 3 + 4 // 7 - 8*(4)
or, 3 + 4 // 7 - 8*4 = 3 + 0 - 8*4
(//, & * has same precedence hence evaluation on the basis of L --> R)
or, 3 + 0 - 32 = - 29
(**) has highest precedence in all operator.
3 + 4 // 7 - 8*(2**2) = 3 + 4 // 7 - 8*(4)
or, 3 + 4 // 7 - 8*4 = 3 + 0 - 8*4
(//, & * has same precedence hence evaluation on the basis of L --> R)
or, 3 + 0 - 32 = - 29
Answered by
2
Answer:
-29
Explanation:
The priorities of operators in python are as followed:
- ()
- ^ or * *
- /, // , %, *
- +,-
Using that,
we solve it in the following order:
- 3+4//7-8*(2* *2)
- 3+4//7-8*4
- 3+0-32
- -29
Similar questions
Computer Science,
8 months ago
Math,
1 year ago
English,
1 year ago
Physics,
1 year ago
Music,
1 year ago