Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

Stumped trying to calculate the question time.

https://w.trhou.se/xbjl0h4zfc

I am not sure what I am missing. I keep getting the following error:

Traceback (most recent call last):
File "quiz.py", line 85, in <module>
Quiz().take_quiz()
File "quiz.py", line 42, in take_quiz
return self.summary()
File "quiz.py", line 83, in summary
print("It took {} seconds to finishe question {}.".format(total_qtime, order))
NameError: name 'total_qtime' is not defined

from what I can tell it is defined but clearly I am wrong. Help would be appreciated.

also, how do you link an image of your code instead of the link?

1 Answer

Steven Parker
Steven Parker
243,266 Points

The snapshot link that you posted is the correct/best way to share code.

The variable "total_qtime" is defined only inside the "ask" method. It's not available from the "summary" method, where the code that references it gets the error.