python中求余数

>>> 5 % 0
Traceback (most recent call last):
  File "<pyshell#354>", line 1, in <module>
    5 % 0
ZeroDivisionError: integer division or modulo by zero
>>> 5 % 1
0
>>> 5 % 2
1
>>> 5 % 3
2
>>> 5 % 4
1
>>> 5 % 5
0
>>> 5 % 6
5
>>> 5 % 7
5
>>> 5 % 8
5
>>> 7 % 8
7

 

posted @ 2020-12-17 18:04  小鲨鱼2018  阅读(3178)  评论(0编辑  收藏  举报