Last active
March 20, 2021 09:24
-
-
Save Kimxons/643fb7f75225ddeb51f2b99de5709454 to your computer and use it in GitHub Desktop.
Hash-backed Maps
This file contains hidden or 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
| #!/usr/bin/python3 | |
| #define dictionary | |
| dic = { | |
| 'alice':100, | |
| 'bob':200, | |
| 'shak':300, | |
| } | |
| #get value by key | |
| x = dic["bob"] | |
| #set value by key | |
| dic["alice"] = 400 | |
| #print all keys | |
| for x in dic: | |
| print(x) | |
| #print all values | |
| for x in dic: | |
| print(dic[x]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment