Home>Article>Backend Development> What is the operation symbol of [//] in python?

What is the operation symbol of [//] in python?

王林
王林 Original
2020-10-20 14:15:30 70159browse

[//] in python is an arithmetic operation symbol, indicating integer division. It will return the integer part of the result, such as [print(7//2)], and the output result is 3. The arithmetic operation symbols in Python include [ ], [-], [*], [%], etc.

What is the operation symbol of [//] in python?

//Operator means downward division, it will return the integer part of the integer division result

(Recommended tutorial:python Video tutorial)

print(7//2) #3

Here, after integer division, it will return 3.5

Similarly, when performing the exponentiation operation, ab will return a raised to the power b

print(2**10) #1024

Finally, %Performs the modulo operation and returns the remainder of the division

print(13%7)#6 print(3.5%1.5)#0.5

Related recommendations:python tutorial

The above is the detailed content of What is the operation symbol of [//] 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