Skip to content

Instantly share code, notes, and snippets.

@mayankdawar
Created August 7, 2020 20:49
Show Gist options
  • Save mayankdawar/517bd73bbe9d83d40f5dacedf828676c to your computer and use it in GitHub Desktop.
Save mayankdawar/517bd73bbe9d83d40f5dacedf828676c to your computer and use it in GitHub Desktop.
The variable nested_d contains a nested dictionary with the gold medal counts for the top four countries in the past three Olympics. Assign the value of Great Britain’s gold medal count from the London Olympics to the variable london_gold. Use indexing. Do not hardcode.
nested_d = {'Beijing':{'China':51, 'USA':36, 'Russia':22, 'Great Britain':19}, 'London':{'USA':46, 'China':38, 'Great Britain':29, 'Russia':22}, 'Rio':{'USA':35, 'Great Britain':22, 'China':20, 'Germany':13}}
london_gold = nested_d['London']['Great Britain']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment