''' Mission 8 - Answer Bot Mild Remix 1C Create a list of sounds and select a random sound when button is pressed. Ths solution includes an introduction and ending. ''' from codex import * import random from time import sleep # my list of sounds my_list = ["sounds/up", "sounds/down", "sounds/one", "sounds/two", "sounds/three", "sounds/four", "sounds/yes", "sounds/no", "sounds/welcome", "sounds/button", "sounds/codex"] # Introduction display.print("A=random ", scale=3) display.print(" sound", scale=3) display.print("D=quit", scale=3) while True: # Play random sound when # Button A is pressed if buttons.was_pressed(BTN_A): item = random.choice(my_list) audio.mp3(item) if buttons.was_pressed(BTN_D): break # Ending message display.print("Thanks", scale=5)