Kevin Tiller

Generation

fix invalid codeThu, 20 Apr 2023

def read_file(): with open('questions.txt') as f: lines = f.readlines() return question_list import random print(random.random("questions.text")) def ask_questions(list_of_questions): import random order = list(range(len(questions))) random.shuffle(order) end_test = False num_questions = len(q) score = 0 while not end_test: num_skipped = [] def display_question(question_number, question): for i in range(num_questions): q_text = q[i][0] q_answer = q[i][1] choices = q[i][2:] print(q_text) print('A. ' + choices[0]) print('B. ' + choices[1]) print('C. ' + choices[2]) print('D. ' + choices[3]) user_answer = input("Please enter A, B, C or D: ").upper() def is_correct_answer(solution, user_answer): if user_answer == q_answer: score += 1 print("Correct!") else: num_skipped.append(q[i]) print("Incorrect. The correct answer is " + q_answer + ".") print("") def next_round(current_round):

def next_round(current_round): if current_round < num_questions: return current_round + 1 else: return 0

Want to kickstart your project?Use the new AI Studio to create your code