CBSE Class 11 Computer Science
Question 76 of 104
List Manipulation — Question 12
Back to all questions 12
Question Question 12
Find the errors:
- L1 = [1, 11, 21, 31]
- L2 = L1 + 2
- L3 = L1 * 2
- Idx = L1.index(45)
Answer
- Line 2 — L2 = L1 + 2 will result in error as one element of + is a list and other is an integer. In Python, operands of + operator should be of same type.
- Line 4 — Idx = L1.index(45) will cause an error as 45 is not present in the list L1.