Apr-10-2020, 03:28 PM
you subscript the dictionary by key to get the value, so coins['Fifty'] will return 50. Unfortunately, the reverse does not work as values are not guaranteed to be unique. You can create a dynamic view with coins.items(), this will give you a list of tuples which then can be accessed as a pair
for coin, value in coins.items(): print(coin,'=',value)Output
Output:Fifty = 50
Twenty = 20
Ten = 10
Five = 5
One = 1