Chapter 11 Assignment
Chapter 11 Assignment
LIST MANIPULATION
Q1. How are lists different from strings when both are sequences?
Q2. Write difference between append( ) and extend( ) methods of list.
Q3. How we can determine the size of the list?
Q4. Can we concatenate two lists? How?
Q5. How we can sort the elements of the list?
Q6. What are nested lists?
Q7. What is the output when we execute list(“hello”)?
Q8. Suppose listExample is [‘h’,’e’,’l’,’l’,’o’], what is len(listExample)?
Q9. Suppose list1 is [12, 323, 2322, 14, 25], what is list1[:-1] ?
Q10. What is the output when following code is executed?
A. >>>names = ['Freya', 'Mohak', 'Mahesh', 'Dwivedi']
>>>print(names[-1][-1])
Page 1 of 2
F. names1 = ['Freya', 'Mohak', 'Mahesh', 'Dwivedi']
if 'freya' in names1:
print(1)
else:
print(2)
J. a=[101,123,561,[178]]
b=list(a)
a[3][0]=915
a[1]=134
print(b)
K. a=[132,526,127]
a.append([827])
a.extend([425,627])
print(a)
Page 2 of 2