In this article, I will talk about the standard number type in python. I hope it can help you who are exposed to python.
The data stored in memory can be of many types.
For example, a person's age can be stored as numbers, and his name can be stored as characters.
Python defines some standard types for storing various types of data. There are five standard data types in Python:
Numbers (Numbers)
String (String)
List (List)
Tuple (Tuple)
Dictionary (Dictionary)
Next, let’s take a look at these five standard data types one by one.
(1) Number (Number) : Numeric data type is used to store numerical values. They are immutable data types, which means that changing the numeric data type allocates a new object.
When you specify a value, a Number object is created. The following example:
var1 = 1 var2 = 10
The above example defines var1=1, var2=10. Since it can be defined, there is also a way to delete it. You can use del to delete references to some objects. The syntax of del is relatively simple. For example Example:
del var1[,var2[,var3[....,varN]]]]
You can also use the del statement to delete references to single or multiple objects. For example:
del var del var_a, var_b
As shown in the figure above, you can delete references to single or multiple objects.
Python supports a total of 4 different numeric types: long Integer [Can also represent octal and hexadecimal]) complex (plural)
(lowercase l can also be used for long integers, but it is still recommended that you use uppercase L, to avoid confusion with the number 1. Python uses L to display long integers.)
(Python also supports complex numbers, which are composed of real numbers and imaginary parts. You can use a bj, Or complex(a,b) means that the real part a and the imaginary part b of the complex number are both floating point types.)
The above content is the first part of the standard number type in python, This part is not difficult to understand. I hope this article can be helpful to you who are learning python.
The above is the detailed content of Python variable types-numeric type number (4 detailed explanations). For more information, please follow other related articles on the PHP Chinese website!