Jia Xu Welcome reprint, Please also keep this statement. Thank you!
Summary: Simple data types and assignments
variables do not need to be declared
Python variables do not need to be declared, you can enter directly:
>>>a = 10
Then your memory has a variable a, its value is 10, its type is an integer (integer). You don't need to make any special statements before, and data types are automatically determined by Python.
>>>print (a)
>>>print (Type (a))
Then there will be the following output:
<class'int'>
Here, we learned a built-in function type () to query the type of the variable.
Reclaim variable names
If you want a to store different data, you do not need to delete the original variable can be directly assigned value.
>>>print (A,type (a))
will have the following output:
1.3 <class ' float ' >
We see another use of print, the print followed by multiple outputs, separated by commas.
Basic data Types
A = ten #int整型
A = 1.3 #float floating-point number
a = True #真值 (true/false)
a = ' Hello' #字符串. Strings can also be enclosed in double quotation marks
These are the most commonly used data types. In addition there are scores, characters, plural and other types, interested can learn about it.
Summary
Variables do not need to be declared, they do not need to be deleted and can be recycled directly.
Type (): Query data type
Integer, floating-point, Truth, String
Python basic 02 base data type