you are looking for the modulo operator:
a % b
for example:
>>> 26 % 7
5
Of course, maybe they wanted you to implement it yourself, which wouldn’t be too difficult either.
More Related Contents:
- Integer division & modulo operation with negative operands in Python
- How do I get 4 instead of 4.0 in "Squirrels and nuts – 1" task? [closed]
- What is the result of % in Python?
- The modulo operation on negative numbers in Python
- How do you check whether a number is divisible by another number?
- Negative integer division surprising result
- What does the percentage sign mean in Python
- Python modulo on floats
- C and Python – different behaviour of the modulo (%) operation
- Modulo operator in Python
- Floor division with negative number
- Is & faster than % when checking for odd numbers?
- How does the modulo (%) operator work on negative numbers in Python?
- In Python, what is a good way to round towards zero in integer division?
- How does Python implement the modulo operation?
- No module named pkg_resources
- Possible to get user input without inserting a new line?
- ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject
- How do you retrieve items from a dictionary in the order that they’re inserted?
- Image rotation while moving
- ‘is’ operator behaves differently when comparing strings with spaces
- How do I pad a string with zeroes?
- Type hint for a function that returns only a specific set of values
- Anaconda vs. miniconda
- Confused about __str__ on list in Python [duplicate]
- How to add a suffix (or prefix) to each column name?
- How to print like printf in Python3?
- How to change a string into uppercase
- Unittest tests order
- Placing Custom Images in a Plot Window–as custom data markers or to annotate those markers