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 Dates and Times in Python (2014) Let's Build a Timed Quiz App Taking The Quiz

Ben Kooijman
Ben Kooijman
3,304 Points

"self" on start_time but not on quiz_start?

In the "ask" method we created a log of the start time and the end time. This is then also done in the "take_quiz" method. However "self" is not used on the question_start but is used on the start_time variable. But self is included in both methods as an argument. How do I know when to use self and when not? I am aware that this is mentioned in earlier courses but it never sticks with me.

1 Answer

Steven Parker
Steven Parker
231,248 Points

The first argument to any function that is a class method is self. It is also used to reference any variable that represents a property of a class object.

It's not used with question_start or question_end because those are simply local variables, and not class properties.