List Manipulation
1.A list is a collection which is ordered and changeable.
2.A list can store different type of values.
3.We can add or remove items from the list
4.In Python lists are written with square brackets.
5.len() function is used to count the number of items in the list
6.append()/insert()/extend() methods are used to add item at the end of the list
7.remove()/clear()/pop()/del keyword are used to delete items from the list
8.Finding largest, smallest and sum of all list of values using min,max, sum methods
9.Sort the list of values using sort method
10.Reverse the list of values using reverse( )
11.Count the frequency of given item in the list using count() method
MULTPILE CHOIC QUESTIONS
a. L1=list( )
b. L1=[1,2,3,4]
c. Both of the above
d. None of the above
a. [‘w’, ‘e’, ‘l’, ‘c’, ‘o’, ‘m’, ‘e’]
b. (‘w’, ‘e’, ‘l’, ‘c’, ‘o’, ‘m’, ‘e’)
c. [‘welcome’]
d. None of the above
>>> L=[‘w’,’e’,’l’,’c’,’o’,’m’,’e’]
>>> print(len(L))
a. 7
b. 8
c. 9
d. None
>>> L=[“Amit”,”Anita”,”Zee”,”Longest Word”]
>>> print(max(L))
a. Zee
b. Longest Word
c. Error
d. None of the above
>>> L=[“Amit”,”Anita”,”Zee”,”Longest Word”,123]
>>> print(max(L))
a. Longest Word
b. Zee
c. Amit
d. Error