In the Python language, variables do not need to be declared, each variable must be assigned before it is used, and the variable will not be created until the value is assigned.
In Python, a variable is a variable he has no type, and the type we call refers to the type of the variable in the in-memory object.
The equals sign (=) is used to assign a value to a variable.
The left side of the equals sign (=) operator is a variable name, and the right side of the equals sign (=) operator is the value stored in the variable.
For example:
counter = # integer variable
miles = 1000.0 # floating-point variable
Name = "runoob" # string
< Span class= "Hl-code" > < Span class= "Hl-identifier" > multiple variables assigned
< Span class= "Hl-code" > < Span class= "hl-comment" > python allows you to assign values to multiple variables at the same time
< Span class= "Hl-code" > < Span class= "hl-comment" > a = B = C =1 / span>
Creates an integer object with a value of 1 and three variables allocated to the same memory space.
a, b , c = 1 Span class= "PLN" > 2 "3"
Two Integer objects 1 and 2 are assigned to variables A and B, the string object "3" is assigned to the variable C
python3 there are six standard data types in Python 2 has only 5 standard data types, 3 adds a collection:
Number
String string
List
Tuple ganso
Sets Collection
Dictionary dictionary
Basic data types for Python