true 'colorin spam keys(false 'colornot in spam keys(true 'colorin spam false in the previous examplenotice that 'colorin spam is essentially shorter version of writing 'colorin spam keys(this is always the caseif you ever want to check whether value is (or isn'ta key in the dictionaryyou can simply use the in (or not inkeyword with the dictionary value itself the get(method it' tedious to check whether key exists in dictionary before accessing that key' value fortunatelydictionaries have get(method that takes two argumentsthe key of the value to retrieve and fallback value to return if that key does not exist enter the following into the interactive shellpicnicitems {'apples' 'cups' ' am bringing str(picnicitems get('cups' )cups ' am bringing cups ' am bringing str(picnicitems get('eggs' )eggs ' am bringing eggs because there is no 'eggskey in the picnicitems dictionarythe default value is returned by the get(method without using get()the code would have caused an error messagesuch as in the following examplepicnicitems {'apples' 'cups' ' am bringing str(picnicitems['eggs']eggs traceback (most recent call last)file ""line in ' am bringing str(picnicitems['eggs']eggs keyerror'eggsthe setdefault(method you'll often have to set value in dictionary for certain key only if that key does not already have value the code looks something like thisspam {'name''pooka''age' if 'colornot in spamspam['color''black