Python list (List)
Python sequence is the most basic data structure. Each element in the sequence is assigned a number - its position, or index, the first index is 0, the second index is 1, and so on.
Python has a built-in type 6 sequences, but the most common are lists and tuples.
The sequence of operations can be carried out, including indexing, slicing, add, multiply, check members.
Further, Python already built determined sequence length and determining the maximum and minimum element method.
Python is a list of the most common types of data, it can appear as a comma-separated values in square brackets.
Data items list need not have the same type
Create a list, as long as the comma-separated data items using different brackets can be. As follows:
Like string indices, list indices start at 0. The list can be intercepted, combinations and the like.
The value of the access list
The subscript index to access the values in the list, you can also use the same form of brackets taken character, as follows:
Examples
Examples of the above output:
list1[0]: physics
list2[1:5]: [2, 3, 4, 5]
update list
You can modify or update data items in the list, you can also add a list item using append () method, as follows:
Examples
Note: Use discussions we will append () method in the next section
Examples of the above output:
['Google', 'Runoob']
Delete list elements
You can use the del statement to remove elements of the list, the following examples:
Examples
Examples of the above output:
['physics', 'chemistry', 1997, 2000] After deleting value at index 2 : ['physics', 'chemistry', 2000]