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

Endtime should be calculated before checking the answer is right or wrong.

If after taking the input from user, machine gets busy from some other thread while checking answer is right or wrong. A user will get penalized for machine time too and this will be variable for different user. By capturing the end time before checking the answer gives lesser chance for error .

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,423 Points

You are correct that system time would factor into the users time value. It is still true to a lesser extent when moving the end time statement earlier. It just reduces the likelihood of a process switch before the end time check. I think one of the lesson goals is to introduce using time generally without getting into the nuances.

On some systems, such as Linux-based systems, you can use time.clock() to get the process time separate from wall-clock time. This would give the more precise values you may be looking for. (see docs).