Find the division remainder of a number

前端 未结 12 1197
刺人心
刺人心 2020-11-28 07:30

How could I go about finding the division remainder of a number in Python?

For example:
If the number is 26 and divided number is 7, then the division remainder

12条回答
  •  自闭症患者
    2020-11-28 08:11

    you are looking for the modulo operator:

    a % b
    

    for example:

    26 % 7
    

    Of course, maybe they wanted you to implement it yourself, which wouldn't be too difficult either.

提交回复
热议问题