xo = {3: 30, 5: 56}
yo = {4: 20, 7: 49}
to = {1: 40, 6: 79}
exd = {}
for w in (xo, yo, to):
exd.update(w)
print(exd) # Выводим объединенный словарь
dict_a = {1: 10, 2: 20}
dict_b = {3: 30, 4: 40}
dict_c = {5: 50, 6: 60}
result = {}
for d in (dict_a, dict_b, dict_c):
result.update(d)
print(result)
yo = {4:20, 7:49}
to = {1:40, 6:79}
exd = {}
for w in (xo, yo, to):
exd.update(w)
print(w)
#
#
#
#
#
dict_a = {1:10, 2:20}
dict_b = {3:30, 4:40}
dict_c = {5:50, 6:60}
result = {}
for d in (dict_a, dict_b, dict_c):
result.update(d)
print(result)
Выход; {1: 40, 6: 79}
{1: 10, 2: 20, 3: 30, 4: 40, 5: 50, 6: 60}
почему в первом случае списки не обьединились?