Home  >  Article  >  Backend Development  >  How to find the remainder in python

How to find the remainder in python

藏色散人
藏色散人Original
2019-06-27 09:52:5866196browse

How to find the remainder in python

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn