The document lists various functions that can be used with lists in Python, including their names, purposes, and formats. Functions such as 'len', 'append', 'remove', and 'sort' are included, providing a quick reference for list operations. Each function is described with its specific usage format for clarity.
Download as TXT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
2 views
List Functions
The document lists various functions that can be used with lists in Python, including their names, purposes, and formats. Functions such as 'len', 'append', 'remove', and 'sort' are included, providing a quick reference for list operations. Each function is described with its specific usage format for clarity.
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1
FUNCTIONS IN LISTS :
Name Function Format
len - tells length of a list
len(l1) list - returns list created from seq type list(seq) index - returns lowest index of a substring l1.index() append - adds an item to the end of list l1.append() extend - adds multiple items at end of list l1.extend([]) insert - adds item to specific position l1.insert(index,item) pop - removes an item by index l1.pop(index) remove - remove a specific item l1.remove() clear - removes all items at once l1.clear() count - tells occurences of a particular item l1.count() reverse - reverses the whole list l1.reverse() sort - sorts items of list in ascending order l1.sort() sorted - sorts items in ascending/descending order sorted(l1)/sorted(l1,reverse=True) min - displays min element of list min(l1) max - displays max element of list max(l1) sum - displays sum of elements in a list sum(l1) del - remove multiple items from list using index del l1[lower index:higher index]