Jan-29-2020, 12:40 AM
class Question: def __init__(self, prompt, answer): self.prompt = prompt self.answer = answer question_prompts = [ # array "What color are apples?\n(a) Red/Green\n(b) purple\n(c) Orange\n\n", "What color are bananas?\n(a) Teal\n(b) Magenta\n(c) Yellow\n\n", "What color are strawberries?\n(a) Yellow\n(b) Red\n(c) Blue\n\n" ] questions = [ Question(question_prompts[0], "a"), Question(question_prompts[1], "c"), Question(question_prompts[2], "b"), ] def run_test(questions): score = 0 for question in questions: answer = input(question.prompt) if answer == question.answer: score += 1 print("You got " + str(score) + "/" + str(len(questions)) + " correct") run_test(questions)This is my first time using Python. I have to make question_prompts, and questions the children. I have to make Question the parent. I've experimented in many ways trying to make each a separate class, I've spent a while trying to figure it out along with reading multiple articles. I am a beginner and would appreciate any help
