''' For this exercise, you can use the following documentation: https://docs.python.org/3/tutorial/datastructures.html#dictionaries. # Dictionaries A dictionary is associative: it links a category to its components, or in Python-language, a key to its values. You can change a dictionary after it has been defined, i.e., it is mutable or changeable. Make a dictionary which contains the words of a sentence as keys and the next word as value. For example, the sentence "Luke, I am your father" would correspond to the following dictionary: ''' example_sentence_dictionary = {"Luke" : "I", "I" : "am", "am" : "your", "your" : "father"} ''' Make a similar dictionary for the sentence: "if you can do it". Do so by defining an empty dictionary and progressively adding items. ''' sentence_dictionary = {} # Define an empty dictionary # You can add an item to the dictionary in the following way: sentence_dictionary["if"] = "you" ''' Now if we slightly change our sentence, we want to be able to remove a key and its value. The new sentence is: "you can do it". Change the existing dictionary to reflect the change in the sentence. Use the `.pop()` method to remove an item. Between the brackets, you only have the include the key; `.pop()` will then remove both the key and its value. ''' # Add your code here print(sentence_dictionary) ''' Now imagine you would want to see which word comes after "do" in the sentence. You can retrieve a value corresponding to a specific key by "indexing" the dictionary with that key. Try this yourself to see which word comes after "can". Also check what happens when you enter a key that is not in the dictionary at all; what kind of error do you get? ''' word_after = sentence_dictionary["do"] print(word_after) ''' Making a sentence dictionary becomes more difficult if you have words that appear in the sentence multiple times. As a value can only contain one variable, you will need to use a list to have multiple words associated to one key. For example, the sentence "It's the eye of the tiger" would become ''' sentence_dictionary = {"It's" : ["the"], "the" : ["eye", "tiger"], "eye" : ["of"], "of" : ["the"]} ''' Make such a dictionary yourself of the sentence "I drink coffee and I eat a pastry". Again, start from an empty dictionary and progressively add items. Remember: if you want to add an item to a list, you can use the method `.append()`. ''' sentence_dictionary = {} sentence_dictionary["I"] = ["drink"]