''' Madlibs Program - starter code ''' from codex import * from time import sleep import random nouns = ["hill", "tuffet", "clock"] verbs = ["broke", "ran", "sat"] animals = ["spider", "mouse", "sloth"] names = ["Jack", "Jill", "Miss"] def bright_pixels(): red = random.randrange(0, 255) green = random.randrange(0, 255) blue = random.randrange(0, 255) color = (red, green, blue) pixels.set(0, color) pixels.set(1, color) pixels.set(2, color) pixels.set(3, color) def random_words(): global name1, name2, noun, verb, animal name1 = random.choice(names) name2 = random.choice(names) noun = random.choice(nouns) #TODO: define variable for verb #TODO: define variable for animal def jack_and_jill(): display.print(name1 + " and " + name2) display.print("went up a " + noun) display.print("to fetch a pail") display.print("of water.") display.print("") display.print("Jack fell down") display.print("and broke his crown") display.print("and Jill came") display.print("tumbling after") def hickory_dickory(): display.print("Hickory dickory ") display.print("dock") display.print("The mouse went up") display.print("the clock") display.print("The clock struck 1") display.print("The mouse ran down") display.print("Hickory dickory ") display.print("dock") def little_miss_muffet(): display.print("Little Miss Muffet") display.print("sat on a tuffet") display.print("eating her curds") display.print("and whey") display.print("Along came a spider") display.print("and sat down ") display.print("beside her") display.print("And frightened Miss") display.print("Muffet away") def menu(): # Introduction display.print("Welocome to") display.print("Madlibs!", scale=4) display.print() display.print("L=Jack & Jill") display.print("R=Hickory Dickory") display.print("A=Little Miss") display.print() display.print("B quit") # === Main program === menu() while True: if buttons.was_pressed(BTN_L): # TODO: Clear the screen # TODO: Call the bright pixels function # TODO: Call the random words function jack_and_jill() display.clear() display.print("Have a good day!")