Computer Science

Evaluate the expression given below if A = 16 and B = 15.
    A % B // A

  1. 0.0
  2. 0
  3. 1.0
  4. 1

Python Funda

10 Likes

Answer

0

Reason — According to operator precedence, floor division (//) and remainder (%) both have equal precedence hence the expression will be evaluated from left to right.

A % B // A
= 16 % 15 // 16
= 1 // 16
= 0

Answered By

6 Likes


Related Questions