Home  >  Article  >  Backend Development  >  What is the operation of two slashes in Python?

What is the operation of two slashes in Python?

藏色散人
藏色散人Original
2019-06-26 10:08:3132195browse

What is the operation of two slashes in Python?

Since version 2.x is no longer updated, only version 3.x of python is currently discussed.

What is the operation of two slashes in Python?

Two slashes in Python, that is, double slashes (//), represent floor division, that is Do the division first (/), then round down (floor). When at least one of the numbers is of type float, the result is of type float; when both numbers are of type int, the result is of type int.


In addition, floor except floor(x) represents the largest integer not greater than x, so it does not take the integer part, such as when x is a negative number:


Recommended study: "Python Tutorial"

The above is the detailed content of What is the operation of two slashes 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