Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Jeffrey Zhang
- #March 10, 2020
- #Dictionaries
- my_dictionary= {
- 'lol': 'laughing out loud',
- 'brb': 'be right back',
- 'btw': 'by the way',
- 'lmk': 'let me know',
- 'gtg': 'got to go',
- 'stfu': 'shut the freak up',
- 'smh': 'shaking my head',
- 'ikr': 'ikr know right'
- }
- while True:
- ask = input ("What do you want to do: get, add, delete, get entire dictionary ")
- if ask == "get":
- key = input ("What is the key? ")
- print (my_dictionary.get(key, "Sorry, I could not find the definition"))
- if ask == "add":
- key = input ("What word would you like added? ")
- value = input ("What definition do you want to go along with the key? ")
- my_dictionary[key] = value
- print (my_dictionary)
- if ask == "delete":
- key = input ("What would you like removed? ")
- del my_dictionary[key]
- print (my_dictionary)
- if ask == "get entire dictionary":
- print (my_dictionary)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement