Built-in List Functions & Methods in Python

Python provides numerous built-in functions and methods to work with lists efficiently. These functions help perform common operations like finding length, maximum/minimum values, and converting sequences to lists.

Built-in List Functions

Python includes the following list functions ?

Sr.No Function with Description
1 len(list)
Gives the total length of the list.
2 max(list)
Returns item from the list with max value.
3 min(list)
Returns item from the list with min value.
4 list(seq)
Converts a sequence (tuple, string, etc.) into a list.

Example of Built-in Functions

# Using built-in list functions
numbers = [3, 7, 2, 9, 1, 5]

print("Length:", len(numbers))
print("Maximum:", max(numbers))
print("Minimum:", min(numbers))

# Converting tuple to list
coordinates = (10, 20, 30)
coord_list = list(coordinates)
print("Converted list:", coord_list)
Length: 6
Maximum: 9
Minimum: 1
Converted list: [10, 20, 30]

Built-in List Methods

Python includes the following list methods ?

Sr.No Methods with Description
1 list.append(obj)
Appends object obj to the end of list
2 list.count(obj)
Returns count of how many times obj occurs in list
3 list.extend(seq)
Appends the contents of seq to list
4 list.index(obj)
Returns the lowest index where obj appears
5 list.insert(index, obj)
Inserts object obj into list at specified index
6 list.pop(index)
Removes and returns item at index (last item if index not specified)
7 list.remove(obj)
Removes first occurrence of obj from list
8 list.reverse()
Reverses the order of list elements in place
9 list.sort()
Sorts list elements in ascending order

Example of List Methods

# Using list methods
fruits = ['apple', 'banana', 'orange']

# append() - add item to end
fruits.append('grape')
print("After append:", fruits)

# insert() - add item at specific position
fruits.insert(1, 'mango')
print("After insert:", fruits)

# count() - count occurrences
fruits.append('apple')
print("Apple count:", fruits.count('apple'))

# index() - find position
print("Orange index:", fruits.index('orange'))

# remove() - remove first occurrence
fruits.remove('apple')
print("After remove:", fruits)

# pop() - remove and return item
removed = fruits.pop()
print("Popped item:", removed)
print("Final list:", fruits)
After append: ['apple', 'banana', 'orange', 'grape']
After insert: ['apple', 'mango', 'banana', 'orange', 'grape']
Apple count: 2
Orange index: 3
After remove: ['mango', 'banana', 'orange', 'grape']
Popped item: grape
Final list: ['mango', 'banana', 'orange']

Conclusion

Python's built-in list functions and methods provide powerful tools for list manipulation. Functions like len(), max(), and min() help analyze lists, while methods like append(), remove(), and sort() modify list contents efficiently.

Updated on: 2026-03-25T07:34:27+05:30

22K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements