Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Separable symbols in python
Separable symbols in python
Mathematically, divisibility means that the quotient of integer B divided by non-zero integer A is an integer. If the remainder is 0, it can be said that B is divisible by A, so there are different operators of division, division and remainder in python.

(1) There are seven arithmetic operators in Python, among which the operator for divisibility is two slashes//. But in python, divisibility is different from divisibility in mathematics. In mathematics, divisibility means that the quotient is an integer, but in python, divisibility means that if there is a decimal in the result, the decimal will be removed. The code example is as follows:

3//2 1

The result of dividing the integer 3 by 2 should be 1.5, but using the divisible operator//will remove the decimal point and the following digits, leaving only the decimal place as the result of 1. This division takes an integer close to the quotient and rounds it down. If it is negative, round it off and add 1. Examples are as follows:

-9//2-5

(2) 2) Another feature of Python divisibility is that decimals can also participate in operations, but this floating-point number can only use 0 as decimals. That is, only the type of floating-point number has no precise decimal value, so the result of divisible operation is floating-point number. As long as one decimal place of the divisor or dividend is 0, the detailed code example is as follows: 3//2.05438+0.03.0//2.05438+0.0.