Skip to content

Instantly share code, notes, and snippets.

@abhi923
Created June 22, 2020 14:05
Show Gist options
  • Save abhi923/c1592ca575e6e1177bf7f1534a8a523b to your computer and use it in GitHub Desktop.
Save abhi923/c1592ca575e6e1177bf7f1534a8a523b to your computer and use it in GitHub Desktop.
dictionary = {"cat" : "chat", "dog" : "chien", "horse" : "cheval"}
phone_numbers = {'boss' : 5551234567, 'Suzy' : 22657854310}
empty_dictionary = {}
words = ['cat', 'lion', 'horse', 'RAT']
for word in words:
if word in dictionary:
print(word, "->", dictionary[word])
else:
print(word, "is not in dictionary")
print(dictionary)
print(phone_numbers)
print(empty_dictionary)
dictionary = {"cat" : "chat", "dog" : "chien", "horse" : "cheval"}
for english, french in dictionary.items():
print(english, "->", french)
dictionary = {"cat" : "chat", "dog" : "chien", "horse" : "cheval"}
for french in dictionary.values():
print(french)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment