JustCaptain kod-buduschego
278f89b670625c4e4b01e3ae728782f1780fa610
Перейти к файлу
Код
kod-buduschego Python 2025-20262.4. Словариcopy_example.py
anc update c70a58f 8 октября 2026 г.
copy_example.py
my_dict = {"username": "Nikita", "age": 28}
new_dict = my_dict
print(my_dict, new_dict, sep="\n")

my_dict["age"] = 35
new_dict["username"] = "Stas"
print(my_dict, new_dict, sep="\n")

print("=" * 15)

test_my_dict = {"username": "Nikita", "age": 28}
test_new_dict = test_my_dict.copy()
print(test_my_dict, test_new_dict, sep="\n")
test_my_dict["age"] = 14
test_new_dict["username"] = "Stas"
print(test_my_dict, test_new_dict, sep="\n")