Three basic data types in Python: list list, tuple tuple and dictionary dict

Python's three basic data types, list list, tuple tuple and dictionary dict

List List: The most basic data type of python, the data items in the list do not need to have the same type and can contain duplicate values. The list includes two modules, elements and corresponding indices, where a positive index value means to fetch from the beginning, and a negative value means to fetch the number backwards.

Operations: Index, slice, add, subtract, multiply, check membership

Index: view the value of an index my_list[1], view the value of the series my_list[1:5]

Slice: my_list[1:5], note: my_list[::n] This usage means to take the nth element from the taken element, and so on

Addition and multiplication: means combining lists, and addition means combining two lists together. Multiplication means copying an element N times

Check member: is to check whether an element is in the list

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326431885&siteId=291194637