Page 136 - TP_Play_V2.2_Class8
P. 136
Output
[1, 2, 3, 5]
[1, 2, 3, 5]
[]
Factbot
The ‘+’ operator when used with lists needs both the operands to be of list type, otherwise it will produce
an error.
Double Tap Century #Information Literacy
21 st
Skills
Match the methods with their functionality.
1. extend( ) a. Removes the first occurrence of a specified element from a list.
2. append( ) b. Reverses the order of the elements in the list
3. remove( ) c. Adds single element at the end of the existing list
4. sort( ) d. Returns the occurrence (number of times) of a particular element in the list
5. reverse( ) e. Sorts all the elements in the list
6. count( ) f. Adds more than one element (in sequential order or elements of the list) to
the end of the existing list
PYTHON FUNCTIONS
Python also provides various built-in Python list functions. The following table describes various Python
built-in functions:
Function Explanation
len(list) Returns the total length of the list
max(list) Returns the largest element from the given list
min(list) Returns the smallest element from the given list
Program 10: To use the built-in Python list functions
Program10.py
File Edit Format Run Options Window Help
list1=[13, 25, 41, 63, 82]
print(len(list1))
print(max(list1))
print(min(list1))
134 Plus (Ver. 4.0)-VIII

