First of all, everyone needs to know what Python operators are. Let’s take a simple example 4 5 = 9. In the example, 4 and 5 are called operands, and " " is called the operator.
The remainder refers to the undivided part of the dividend in integer division, and the remainder ranges from 0 to the divisor (excluding the divisor).
For example: 27 divided by 6, the quotient is 4 and the remainder is 3.
So how to find the remainder in python?
Finding the remainder in Python is also very simple. Use the operator %, which means taking the modulo and returning the remainder of the division.
Assume variables: a=10, b=20, then the output result of b%a, the remainder, is 0.
Related recommendations: "Python Tutorial"
The above is the detailed content of How to find the remainder in python. For more information, please follow other related articles on the PHP Chinese website!