本文介绍了求一个数的除法余数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我怎样才能在 Python 中找到一个数字的除法余数?
How could I go about finding the division remainder of a number in Python?
例如:如果数为26,被除数为7,则除法余数为5.(因为 7+7+7=21 和 26-21=5.)
For example: If the number is 26 and divided number is 7, then the division remainder is 5. (since 7+7+7=21 and 26-21=5.)
推荐答案您正在寻找模运算符:
a % b例如:
26 % 7当然,也许他们希望你自己实现它,这也不会太难.
Of course, maybe they wanted you to implement it yourself, which wouldn't be too difficult either.
更多推荐
求一个数的除法余数
发布评论