Professional Documents
Culture Documents
CLASS-XI
SUBJECT- COMPUTER SCIENCE PYTHON
TOPIC : LIST
3. Which of the following functions will add only one element in the list?
4. Which of the following functions will always remove the last element from
the list ?
(a) clear() (b) remove() (c) count() (d) pop()
5. Assertion (A) :-
Lists allows us to change individual elements but this is not possible in the
case of string.
Reason (R) :
Lists is mutable whereas string is immutable in nature.
8|Page
FILL IN THE BLANKS
1. The ______ loop makes it easy to traverse over the items in a list.
2. The _____ operator is used to replicate a list specified number of times.
3. The empty brackets [ ] indicate an ______ list.
4. _______ is an extracted part of the list.
5. The ______ function is used to insert an element at a designated position in a list.
OUTPUT CODES
9|Page
5. Write the output of the following code:
L=[]
L1=[]
L2=[]
for x in range(1,10):
L.append(x)
for x in range(10,1,-2):
L1.append(x)
for x in range(len(L1)):
L2.append(L1[x]+L[x])
L2.append(len(L)-len(L1))
print(L2)
HOTS QUES.
1. Observe the given list and write the results of the following slices:-
L=[11,12,13,14,15,16,17,18,19,20]
(a) L[2:9]
(b) L[0:8]
(c) L[5:]
(d) L[:6]
(e) L[-8:-2]
2. CASE STUDY:
Observe the given List and give the result of following given methods:
List1=[21,22,23,24,25,26,27,28,29,30]
(a) print(List1.append(31))
(b) print(List1.extend([32,33,34])
(c) print(List1.remove(23))
(d) print(List1.pop(5))
(e) print(List1.insert(4,35))
(f) print(List1.sort())
10 | P a g e
PROGRAMS
1. WAP to initialize a list L , and the resultant list should be such that all even elements
should get multiplied by 3 and all the odd elements should get incremented by 5.
2. WAP to initialize a list L and resultant list should be such that it should transfer all
the multiple of 4 to new list M.
11 | P a g e