What is the operation of two slashes in Python?

藏色散人
Release: 2019-08-01 15:38:27
Original
32206 people have browsed it

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template