How to calculate a mod b in Python?

后端 未结 7 1273
迷失自我
迷失自我 2020-12-12 21:47

Is there a modulo function in the Python math library?

Isn\'t 15 % 4, 3? But 15 mod 4 is 1, right?

7条回答
  •  感动是毒
    2020-12-12 22:03

    There's the % sign. It's not just for the remainder, it is the modulo operation.

提交回复
热议问题