## Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

### Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

# Keep getting: You got 1 out of 10 right.

Can someone help me out here? Thanks!

```import datetime
import random

class Quiz:
questions = []

def __init__(self):
for _ in range(10):  # Generate 10 random questions with numbers from 1 to 10
num1 = random.randint(1, 10)
num2 = random.randint(1, 10)
question = random.choice(question_types)(num1, num2)
self.questions.append(question)  # Add these questions into self.questions

def take_quiz(self):
# Log the start time
self.start_time = datetime.datetime.now()
for question in self.questions:
# Log if they got the questions right
# Log the end time
else:
self.end_time = datetime.datetime.now()
# Show a summary
return self.summary()

correct = False
# Log the start time
question_start = datetime.datetime.now()
answer = input(question.text + ' = ')
correct = True
# Log the end time
question_end = datetime.datetime.now()
# If the answer's right, send back True
# otherwise, send back False
# send back the elapsed time
return correct, question_end - question_start

def total_correct(self):
# Return the total number of correct answers
total = 0
total += 1

def summary(self):
# Print how many you got right and the total number of questions. ex: 5/10
print("You got {} out of {} right.".format(self.total_correct(), len(self.questions)))
# Print the total time for the quiz: 30 seconds!
print("It took you {} seconds to complete!".format((self.end_time - self.start_time).seconds))

Quiz().take_quiz()
``` 