Skip to content

Instantly share code, notes, and snippets.

@Kimxons
Last active March 20, 2021 09:24
Show Gist options
  • Save Kimxons/643fb7f75225ddeb51f2b99de5709454 to your computer and use it in GitHub Desktop.
Save Kimxons/643fb7f75225ddeb51f2b99de5709454 to your computer and use it in GitHub Desktop.
Hash-backed Maps
#!/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