And the data type of the variable python

In Python, usually expressed with constants in all uppercase variable names:
PI = 3.14159265359

But the fact PIremains a variable, Python did not have any mechanism to ensure that PIwill not be changed, so, with all uppercase variable name indicates the usage of the constants just a habit, if you must change the variable PIvalue, no one can stop you.

In Python, there are two division a division is /:

>>> 10 / 3
3.3333333333333335

/Floating-point division calculation result, even exactly divisible by two integers, floating point result is:

>>> 9 / 3
3.0

There is also a division is //called the floor in addition, two integer division still is an integer:

>>> 10 // 3
3

You read right, integers floor in addition to //always be an integer, even though indivisible


Guess you like

Origin blog.csdn.net/qq_19672707/article/details/79155537