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 trialRoger Finlayson
3,236 Pointsminutes.py got the wrong number of minutes
I do not understand why this keeps giving me the wrong answer. I wrote it in a file in workspaces and it was fine.
import datetime
def minutes(dt1, dt2):
diff = dt2 - dt1
return round(diff.total_seconds()/60)
2 Answers
Chris Freeman
Treehouse Moderator 68,441 PointsYour code is correct and should pass the challenge. There appears to be a bug in the checker. The challenges was recently changed to distinguish between using the attribute seconds
and the method total_seconds()
.
Flagging Kenneth Love to check the validation on the Timedelta Minute challenge.
The posted code:
import datetime
def minutes(dt1, dt2):
diff = dt2 - dt1
return round(diff.total_seconds()/60)
Got the response:
Bummer! Got the wrong number of minutes. Expected 67, got 1507.
It seems the challenge has the old expected value from before the test data was changed to be greater than a day.
Roger Finlayson
3,236 PointsPhew, thanks Chris.
Gianmarco Mazzoran
22,076 Points.append() myself to this post, just in case the notification of the debug is posted here!
Kenneth Love
Treehouse Guest TeacherUpdated the prompt and the checker. Your original code should pass now.
Gianmarco Mazzoran
22,076 PointsThanks Kenneth!
Chris Freeman
Treehouse Moderator 68,441 PointsChris Freeman
Treehouse Moderator 68,441 PointsSorry. You will need to come back to this challenge once the checker bug is fixed.