def addpick(cuedictionary)from madlib py '''prompt for user response using the cue stringand place the cue-response pair in the dictionary ''promptformat "enter specific example for {name}prompt promptformat format(name=cueresponse input(promptdictionary[cueresponse def getuserpicks(cues)'''loop through the collection of cue keys and get user choices return the resulting dictionary ''userpicks dict(for cue in cuesaddpick(cueuserpicksreturn userpicks def tellstory(storyformat)'''storyformat is string with python dictionary references embeddedin the form {cueprompt the user for the mad lib substitutions and then print the resulting story with the substitutions ''cues getkeys(storyformatuserpicks getuserpicks(cuesstory storyformat format(**userpicksprint(storydef main()originalstoryformat ''once upon timedeep in an ancient junglethere lived {animalthis {animalliked to eat {food}but the jungle had very little {foodto offer one dayan explorer found the {animaland discovered it liked {foodthe explorer took the {animalback to {city}where it could eat as much {foodas it wanted howeverthe {animalbecame homesickso the explorer brought it back to the jungleleaving large supply of {foodthe end ''tellstory(originalstoryformatinput("press enter to end the program "main(does the use of well-named functions make it easier to follow this codewe have broken the large overall problem into many smaller steps make sure you follow the flow of execution and data and see how all the pieces fit together mad libs revisited