Python-Quizzes | Python Dictionary Quiz | Question 5

Last Updated :
Discuss
Comments

Question 5:Find the output of the following program:

Python
d = {1 : [1, 2, 3], 2: (4, 6, 8)} 
d[1].append(4) 
print(d[1], end = " ") 
li = [d[2]]
li.append(10) 
d[2] = tuple(L) 
print(d[2]) 

[1, 2, 3, 4] ((4, 6, 8), 10)

[1, 2, 3, 4] (4, 6, 8, 10)

[1, 2, 3, 4] TypeError: tuples are immutable

[1, 2, 3, 4] [4, 6, 8, 10]

Share your thoughts in the comments