strings, numbers, lists, tuples, dictionaries
Variable non-volatile
1. Variable: List
Such as:
>>> a = ["123", "xiaoxing"]
>>> ID (a)
4314085280
>>> a[0] = "Ceshi"
>>> ID (a)
4314085280
>>>
Here we first assign a value to the list A, get the ID (a), that is, the memory address is 4314085280
After we modify the value of the element in List A, the memory address of the re-acquisition of a is still unchanged, but the internal value has been modified, so the list is mutable.
2. Immutable: string, number, tuple
The string immutable example is as follows:
>>> name = "Xiao"
>>> ID (name)
4314237280
>>> name = "Xing"
>>> ID (name)
4314237424
>>>
Here we assign a value to the variable first Xiao, get the memory address is 4314237280, when we assign the variable again worth time, again get memory address discovery has changed, equivalent to the original created variable memory address is immutable
and cannot be modified, so the re-assignment requires a re-opening of the memory address, so it is immutable
Access Order:
1. Sequential access: strings, lists, tuples
2. Mapping: Dictionaries
Number of elements to store:
Container type: list, tuple, dictionary (represents can hold multiple values)
Atomic type: Number, string (represents can hold a value)
Python learning "5th article": Data types and Variables summary