Home > Article > Backend Development > What is a Python Number? What are the Python number types?
To know Python data types, First we have to understand what Python Number (number) is. The content of this chapter is an introduction. Python Number is different from Mathematics concept. Python number type is used to store numerical values. Data type is not allowed to be changed. This means that if you change the value of the Number data type, the memory space will be reallocated.
So what is Python Number? The following instance of a Number object will be created when a variable is assigned a value:
var1 = 1 var2 = 10
You can also use the del statement to delete some Number object references.
The syntax of the del statement is:
del var1[,var2[,var3[....,varN]]]]
You can delete single or multiple objects by using the del statement, for example:
del var del var_a, var_b
The first line It means to use the del statement to delete the variable system named var
The second line means to delete the two small categories a and b in the var system.
Through the introduction to Python Number, we can learn what the Python number type is:
supports four different Python Data type:
1.Integer type (Int) - usually It is called an integer or an integer, a positive or negative integer without a decimal point.
2.Long integers - Integer of infinite size, the last integer is an uppercase or lowercase L.
3.Floating point type (floating point real values) - The floating point type consists of an integer part and a decimal part. The floating point type can also be expressed using scientific notation (2.5e2 = 2.5 x 102 = 250)
4.Complex numbers (complex numbers) - Complex numbers are composed of real parts and imaginary parts, and can be represented by a bj, or complex(a,b), complex numbers The real part a and the imaginary part b are both floating point types.
log | float | ||
0.0 | |||
-0x19323L | 15.20 | ||
-21.9 | 9.322e-36j | ||
0xDEFABCECBDAECBFBAEl | 32.3 e18 | .876j | |
535633629843L |
-90. |
-.6545 0J | |
-052318172735L | -32.54e100 |
3e 26J |
|
-4721885298529L | 70.2-E12 | 4.53e-7j |
2.Python also supports complex numbers. Complex numbers are composed of real parts and imaginary parts. They can be represented by a bj, or complex(a,b). The real part a and the imaginary part b of the complex number are both floating point types.
For more related knowledge, please visit the
Python tutorialcolumn on the php Chinese website.
The above is the detailed content of What is a Python Number? What are the Python number types?. For more information, please follow other related articles on the PHP Chinese website!