A list of lists.
L = [' aaa ', ' BBB ', 89]
A list is an ordered set of mathematical meanings, that is, the elements in the list are arranged in order.
Check:
How do I get the nth data from a list? The method is to get the specified element in the list by index.
You can also get the elements in the list in reverse. L[-1] Represents the last element 89.
Increase:
List.append () to add a new element to the list trailer
List.insert (n,element), adds the element (the new one that represents the addition) to the position n in the list.
By deleting:
Can be deleted by the list pop() method, the Pop () method always deletes the last element of the list, and it also returns the element.
Change:
To assign a value to an index in a list, you can replace the original element with the new element directly, and the list contains the same number of elements.
Second, tuple tuples
Like list, a tuple cannot be modified once it is created.
Create an example: T = (' Adam ', ' Lisa ', ' Bart '), note that the tuple uses () to wrap the elements together.
If there is only one element in a tuple, add one after the element, such as T = (' Adam ',)
Data types in Python