# dictionary -- mutable container of items (key/value pairs) accessible by key
funWords = {
    "defenestration": "the action of throwing someone out of a window",
    "amiable": "having or displaying a friendly and pleasant manner",
    "cockatiel": "a slender long-crested Australian parrot related to the cockatoos",
    "quixotic": "not sensible about practical matters",
    "absquatulate": "to leave somewhat abruptly",
    "floccinaucinihilipilification": "the action or habit of estimating something as worthless",
    "vomitous": "nauseauting or repulsive"
}

# iterating through the dictionary by key
for key in funWords:
    value = funWords[key]
    print("key is: ", key, "... and value is: ", value)

# getting elements as a list
allKeys = funWords.keys() # list of all keys
allValues = funWords.values() # list of all values
allItems = funWords.items() # list of all items as key/value pairs

# accessing items
definition0 = funWords["cockatiel"] # returns value associated with the key "cockatiel"
definition1 = funWords.get("cockatiel") # return value associated with the key "cockatiel"
definition2 = funWords.get("barbaric", "unknown definition") # return value associated with the key "barbaric", or returns "unknown definition" if not found
definition3 = funWords.get("cockatiel", "unknown definition") # return value associated with the key "barbaric", or returns "unknown definition" if not found

# modifying dictionary & a recap on usages of different brackets
# () -- anytime we call a function
# {} -- used to initialize a dictionary
# [] -- index operator and slice operator for strings/lists, index operator for dictionaries, used to initialize a list
funWords["vomitous"] = "inducing nausea" # change value associated with given key
funWords["alopecia"] = "hair loss" # add a new key/value pair

# containment/membership operator for KEYS (not values!)
bool1 = "amiable" in funWords # True, as "ambiable" is a key in the dictionary
bool2 = "hair loss" in funWords # False, as "hair loss" is not a KEY
bool3 = "hair loss" not in funWords # True

del funWords["alopecia"] # remove an item from the dictionary
length = len(funWords) # number of items in the dictionary