from codex import * from time import sleep import random while True: num_list = ["T/F When Columbus sailed from Spain on his epic journey he expected to find India.", "T/F The Pilgrims left England and sailed for America to avoid paying taxes to the king.", "T/F The Stamp Act was a tax imposed on the colonists by the British which taxed almost everything made of paper.", "T/F During World War I the USA was a member of The Alliance For Defeat of Germany.", "T/F The Dust Bowl was a place outside of Washington, DC where automobiles raced.", "T/F During the Gold Rush, gold was found in California."] display.print("Press A for True", color = GREEN) display.print("Press B for False", color = GREEN) display.print() display.print("Press Button R to begin", color = BLUE) display.print("Press Button L to QUIT", color = RED) def show_random_question(): display.clear() num = random.randrange(6) randomq = num_list[num] display.print(randomq) sleep(5) return num while True: if buttons.was_pressed(BTN_R): num = show_random_question() sleep(1.5) if (num == 0 or num == 2 or num == 5) and buttons.was_pressed(BTN_A): display.clear() display.print("CORRECT", color = GREEN) audio.mp3('sounds/right') display.print() pixels.fill(GREEN) sleep(3) pixels.off() display.clear() elif (num == 1 or num == 3 or num == 4) and buttons.was_pressed(BTN_B): display.clear() display.print("CORRECT", color = GREEN) audio.mp3('sounds/right') display.print() pixels.fill(GREEN) sleep(3) pixels.off() display.clear() elif (num == 1 or num == 3 or num == 4) and buttons.was_pressed(BTN_A): display.clear() display.print("INCORRECT", color = RED) audio.mp3('sounds/no') display.print() pixels.fill(RED) sleep(3) pixels.off() display.clear() elif (num == 0 or num == 2 or num == 5) and buttons.was_pressed(BTN_B): display.clear() display.print("INCORRECT", color = RED) audio.mp3('sounds/no') display.print() pixels.fill(RED) sleep(3) pixels.off() display.clear() display.print("Press A for True", color = GREEN) display.print("Press B for False", color = GREEN) display.print() display.print("Press Button R to begin", color = BLUE) display.print("Press Button L to QUIT", color = RED) if buttons.was_pressed(BTN_L): break