Computer Science, asked by raj2299, 1 year ago

evaluate python expression 3+4//7-8*(2**2)

Answers

Answered by IMWorrier
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

Answered by allysia
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