# write a function that takes # a dictionary of animals and sounds; for example, # {'pig': 'oink', 'horse':'neigh'} # # Use the given animals and sounds and # print the "Old MacDonald had a farm" song # # (https://www.youtube.com/watch?v=LIWbUjHZFTw) # # Old MacDonald had a farm # E I E I O # And on his farm he had a #animal# # E I E I O # With a #sound# #sound# here # And a #sound# #sound# there # Here a #sound#, there a #sound# # Everywhere a #sound# #sound# # Old MacDonald had a farm # E I E I O def macDonald(animal_dict): for animal in animal_dict.keys(): # keys() print("Old MacDonald had a farm E I E I O") print("And on his farm, he has a", animal, "E I E I O") print("With a", animal_dict[animal], "here, and a", animal_dict[animal], "there") print("Here a", animal_dict[animal], "there a", animal_dict[animal], \ "everywhere a", animal_dict[animal], animal_dict[animal]) print("Old MacDonald had a farm E I E I O") print() # for k_animal, v_animal in animal_dict.items(): # print("Old MacDonald had a farm E I E I O") # print("And on his farm, he has a", k_animal, "E I E I O") # print("With a", v_animal, "here, and a", v_animal, "there") # print("Here a", v_animal, "there a", v_animal, \ # "everywhere a", v_animal, v_animal) # print("Old MacDonald had a farm E I E I O") # print() animals = {"pig": "oink", "horse": "neigh", "chicken": "bawk", \ "dino": "ooo", "cat": "meow"} macDonald(animals)