Test Index
Python Revision Tour
© examsnet.com
Question : 79 of 102
Marks:
+1,
-0
Given the following Tuple
Tup= (10, 20, 30, 50)Which of the following statements will result in an error ?
[CBSE 2023 Set 4]
Solution:
Concept:A tuple is immutable: once created, elements cannot be added, removed or changed. Indexing, slicing and
len() only read the tuple, so they work.Explanation:Tup.insert(2,3) tries to add an element. A tuple has no insert() method, so Python raisesAttributeError: 'tuple' object has no attribute 'insert'The other three statements print 10, (20,) and 4.Answer:Option B (
Tup.insert (2,3))© examsnet.com
Go to Question: