DEV Community

S3CloudHub
S3CloudHub

Posted on

Python Lists And List Functions

image alt text here

Python List Methodshas multiple methods to work with Python lists, Below we’ve explained all the methods you can use with Python lists, for example, append(), copy(), insert() and more.

List Methods
S.no Method Description

1 append() Used for appending and adding elements to the end of the List.

2 copy() It returns a shallow copy of a list

3 clear() This method is used for removing all items from the list.

4 count() This methods count the elements

5 extend() Adds each element of the iterable to the end of the List

6 index() Returns the lowest index where the element appears.

7 insert() Inserts a given element at a given index in a list.

8 pop() Removes and returns the last value from the List or the given index value.

9 remove() Removes a given object from the List.

10 reverse() Reverses objects of the List in place.

11 sort() Sort a List in ascending, descending, or user-defined order

12 min() Calculates minimum of all the elements of List

13 max() Calculates maximum of all the elements of List

Top comments (0)