What does the / / symbol refer to in Python
Today, the editor will share with you the relevant knowledge of what the / / symbol in Python refers to. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.
/ / what does the symbol mean
The / / in Python means to round down
A _.
For example:
5Universe 2 (2.5 rounded to negative infinity to 2), and-5 racer to negative infinity 3 (- 2.5 rounded to negative infinity to-3)
The difference between / and / /
What is the difference between / and / in the Python language?
In Python / represents floating-point division and returns a floating-point result, that is, the result is a floating-point number, while / / represents integer division in Python and returns the largest integer greater than the result, which means that the division result is rounded down.
For example, print ("6 / 4 =" + str (6 / 4)) print ("6 / 4 =" + str (6 / 4))
Results:
6 / 4 = 1
6 / 4 = 1.5
Python arithmetic operator
The following hypothetical variables await 10 and bounce 21:
The operator +: add-two objects are added together, and the instance aplyb outputs the result 31.
The operator--: minus-- gets a negative number or one number minus another, and the example Amurb outputs the result-11.
Operator: multiply-multiply two numbers or return a string that has been repeated several times. The example ab outputs the result.
The operator /: divides-x by y, and the example bplink an outputs 2.1.
Operator%: modulo-returns the remainder of division, b% an outputs result 1.
Operator: power-returns x to the power of y, and ab to the power of 21 of 10.
Operator / /: take integral division-take the integer close to the quotient, example > 9 prime 24 >-9 prime 25
The above is all the content of the article "what does the / / symbol in Python refer to". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.