# Example: write a program that prints # a list of colors list_of_colors = ["green", "blue", "red", "yellow"] index = 0 while index < len(list_of_colors): print(list_of_colors[index]) index += 1 # write a function that takes # a list of animals and a list of sounds. # Use the given animals and sounds and # print the "Old MacDonald had a farm" song # # You may assume that the sizes of both lists are the same # (that is, the number of animals and sounds given are the same) # # 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(myanimals, mysounds): number = len(myanimals) i = 0 while i < number: # when to stop print("Old MacDonald had a farm E I E I O") print("And on his farm, he has a", myanimals[i], "E I E I O") print("With a", mysounds[i], "here, and a", mysounds[i], "there") print("Here a", mysounds[i], "there a ", mysounds[i], "everywhere a", mysounds[i], mysounds[i]) print("Old MacDonald had a farm E I E I O") print() i += 1 animals = ["pig", "horse", "chicken", "dino", "cat"] # 5 items sounds = ["oink", "neigh", "bawk", "ooo", "meow"] # 4 items macDonald(animals, sounds)