Source Code:
(back to article)
original_dict = {'key1': [1, 2, 3], 'key2': 'value2'} new_dict = original_dict.copy() new_dict['key1'][0] = 4 print(original_dict) # {'key1': [4, 2, 3], 'key2': 'value2'} print(new_dict) # {'key1': [4, 2, 3], 'key2': 'value2'}
Result:
Report an issue