import random
# Define the range of numbers to use in the questions
MIN_NUMBER = 1
MAX_NUMBER = 10
# Define the number of questions to ask
NUM_QUESTIONS = 5
# Initialize the answer key and score
answer_key = []
score = 0
# Generate and ask the questions
for i in range(NUM_QUESTIONS):
# Generate two random numbers within the specified range
num1 = random.randint(MIN_NUMBER, MAX_NUMBER)
num2 = random.randint(MIN_NUMBER, MAX_NUMBER)
# Generate a random operator
operator = random.choice(['+', '-', '*'])
# Ask the question and get the answer from the user
question = f"What is {num1} {operator} {num2}? "
user_answer = input(question)
# Check if the answer is correct and update the score
expression = question[len("What is "):len(question)-1]
if eval(expression) == int(user_answer):
answer_key.append('C')
score += 1
else:
answer_key.append('I')
# Print the answer key and score
print("Answer Key:", ' '.join(answer_key))
print("Score:", score, "/", NUM_QUESTIONS)