import sys print("Python version") print (sys.version) currency_1 = {'Pound': 0.091, 'Euro': 0.093, 'Usd': 0.121} currency_2 = {'Pound': 0.083, 'Afghani': 9.12, 'Romanian_Leu': 2.08} # for Python 3.5 or greater # new dictionary is a shallowly merged dictionary of currency_1 and currency_2 # with values from currency_2 replacing those from currency_1 currency = {**currency_1, **currency_2 } print(currency) # in Python 2, (or 3.4 or lower) def merge_two_dicts(currency_1, currency_2): currency = currency_1.copy() # start with currency_1 currency.update(currency_2) # modifies currency with currency_2 return currency currency = merge_two_dicts(currency_1, currency_2) print(currency) # Python 3.9.0 or greater currency = currency_1 | currency_2 print(currency) # output # Python version # 3.9.0 (v3.9.0:9cf6752276, Oct 5 2020, 11:29:23) # [Clang 6.0 (clang-600.0.57)] # {'Pound': 0.083, 'Euro': 0.093, 'Usd': 0.121, 'Afghani': 9.12, 'Romanian_Leu': 2.08} # {'Pound': 0.083, 'Euro': 0.093, 'Usd': 0.121, 'Afghani': 9.12, 'Romanian_Leu': 2.08} # {'Pound': 0.083, 'Euro': 0.093, 'Usd': 0.121, 'Afghani': 9.12, 'Romanian_Leu': 2.08}