Computer Science

Find the errors:

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

Python List Manipulation

21 Likes

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.

Answered By

9 Likes


Related Questions