Continue punch

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/weixin_45796066/article/details/102739717

Today learned how to create lists and tuples

1. Create a list with []; tuple created with ().
2. If the tuple or list represents only one element, it is necessary to add a comma after the only element.
3.in operator:
for determining whether a tuple list or an element comprising, if the return True.
Length, maximum and minimum values: built-in function len (), max (), min ().
4. unpack sequence: program allows assigning sequence (or a list of tuples, etc.) directly to a plurality of variables, each element of a sequence at this time is sequentially assigned to each variable.
5.remove () method: Enter the element you want to delete and remove the first element found.
6.clear () method: clear the list of all the elements.
7.slice syntax: 1. Assignment 2. Increase element 3. remove elements.
8.index () method: determine the position of an element that appears in the list.
9.pop () method: the list as a "stack" used to achieve functional elements of the stack.
10.reverse () method: the list of elements in the reverse storage.
11.sort () method: sort the list elements.

Guess you like

Origin blog.csdn.net/weixin_45796066/article/details/102739717