CBSE Class 11 Computer Science Question 78 of 104

List Manipulation — Question 14

Back to all questions
14
Question

Question 13b

Find the errors:

L1 = [1, 11, 21, 31]
An = L1.remove(31)
print(An + 2)

Answer

An + 2 will cause an error because remove() function does not return the removed element so An will be None. Addition operator (+) does not allow any of its operands to be None hence, it will raise a TypeError.

Answer