0 0 votes What is the final value printed by the following Python code snippet? def mutate_dict(d): d['a'] = 20 d['c'] = 40 d1 = {'a': 10, 'b': 20} d2 = d1 d2['b'] = 30 mutate_dict(d1) print(d2['a'] + d1['b'])$60$ $50$ $40$ Cannot be determined Programming in Python goclasses python-&-dsa goclasses-da-dpp goclasses-da-dpp-day-71 goclasses-python-&-dsa-practice-questions + – GO Classes 192 views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
0 0 votes This question tests the understanding of mutable objects (dictionaries) and variable referencing in Python. Dictionaries are mutable, and assignments like $\verb|d2 = d1|$ create a shared reference.$\verb|d2['a']|$ is $20.$$\verb|d1['b']|$ is $30.$Result: $20+30=50$. GO Classes answered Dec 19, 2025 GO Classes comment Share Follow 0 reply Please log in or register to add a comment.