Home »
Python »
Python Tuples MCQs
What will be the output of the following code? | Tuples Que. 35
35. What will be the output of the following code?
t1=("hello","hi",[100,1000,10000])
t1[2][1]=2000
print(t1)
- It will show you the error as tuples are immutable
- It will change Hi to 2000
- ('hello', 'hi', [100, 2000, 10000])
- ('hello', '2000', [100, 2000, 10000])
Answer: C) ('hello', 'hi', [100, 2000, 10000])
Explanation:
Tuples are immutable but if there is any list inside a tuple then you can easily update the value of that list or mutable data type.