''' Mission 8 - Answer Bot Mild Remix 1AA Create a list of colors and select a random color when button is pressed. This solution uses BTN_A for the left pixels and BTN_B for the right pixels. ''' from codex import * import random from time import sleep # My list of colors my_colors = [RED, GREEN, BLUE, WHITE, PURPLE, PINK, YELLOW, ORANGE] # Instructions display.print("A=left pixels", scale=3) display.print("B=right pixels", scale=3) display.print("D=quit", scale=3) while True: # Display random answer pixel color when # Button A is pressed (left pixels) if buttons.was_pressed(BTN_A): my_choice = random.choice(my_colors) pixels.set(0, my_choice) pixels.set(1, my_choice) # Display random answer pixel color when # Button B is pressed (right pixels) if buttons.was_pressed(BTN_B): my_choice = random.choice(my_colors) pixels.set(2, my_choice) pixels.set(3, my_choice) if buttons.was_pressed(BTN_D): break # Ending message display.print("Thanks", scale=5)