Created
August 7, 2020 20:51
-
-
Save mayankdawar/3810b8df15c47abc0f1f3ac3899d34e0 to your computer and use it in GitHub Desktop.
Below, we have provided a nested dictionary. Index into the dictionary to create variables that we have listed in the ActiveCode window.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sports = {'swimming': ['butterfly', 'breaststroke', 'backstroke', 'freestyle'], 'diving': ['springboard', 'platform', 'synchronized'], 'track': ['sprint', 'distance', 'jumps', 'throws'], 'gymnastics': {'women':['vault', 'floor', 'uneven bars', 'balance beam'], 'men': ['vault', 'parallel bars', 'floor', 'rings']}} | |
# Assign the string 'backstroke' to the name v1 | |
v1 = sports['swimming'][2] | |
# Assign the string 'platform' to the name v2 | |
v2 = sports['diving'][1] | |
# Assign the list ['vault', 'floor', 'uneven bars', 'balance beam'] to the name v3 | |
v3 = sports['gymnastics']['women'] | |
# Assign the string 'rings' to the name v4 | |
v4 = sports['gymnastics']['men'][-1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment