Home > Article > Backend Development > 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!