1.

Which of the following are not valid operations in python? i. Slicing a listii. Concatenation of a list and a tuple iii. Slicing a dictionary iv. Adding an element to an existing tuple

Answer»

Adding an element to an existing tuple.

Answer : (II) , (III) and (IV)

Reason : 

1. For part (II) - You can't concatenate different data types 

2. For part (III) - Dictionaries and unordered data types so you can't slice them the way you can slice strings or tuples or lists

3. For part (IV) - Whenever you add an element to tuple, A new tuple is formed because Tuples are immutable data types



Discussion

No Comment Found

Related InterviewSolutions