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 trialY B
14,136 PointsCan't get this question in time delta quiz
This works in the interpreter but not in the time delta quiz when asked to create a time delta for 5 minutes I used:
datetime.timedelta(minutes=5)
(ie filling in minutes and 5 for the quiz)
but unfortunately that fails?
6 Answers
Kenneth Love
Treehouse Guest TeacherThe question is to go back 5 minutes. So you want -5
not 5
.
Y B
14,136 PointsAh... I had to laugh when I read your answer - silly me I didn't see the go back bit.
Thanks.
ericb2
11,429 Points2 issues with this quiz question.
1) "Create a timedelta that goes back 5 minutes." does not specify whether the timedelta will be added or subtracted.
2) datetime.timedelta(seconds = -5*60) fails the quiz but works in python.
Wayne Machuca
1,804 PointsI'm running Python 3.4 along with the workspace.
Interesting, When I dir(datetime.datetime), 'minute' shows up as a parameter but fails in test. So I tried 'seconds=-300' which works in Python but fails on the quiz (see YB's post)
But, I changed it to 'minutes=-5' and that worked for both Python and the quiz.
Kenneth Love
Treehouse Guest Teacherdatetime.datetime
and datetime.timedelta
are not the same thing.
Stephen Hutchinson
8,426 PointsFound a problem in the tests:
datetime.timedelta(seconds=-300)
The above fails
Mohammed Ismail
7,190 Pointsdatetime.timedelta(minutes=-5) should work fine.
Abhishek Gangadhar
9,467 PointsAbhishek Gangadhar
9,467 PointsIsn't a timedelta only associated with (days, seconds, microseconds) I thought you couldnt use minutes in the case of timedeltas
Kenneth Love
Treehouse Guest TeacherKenneth Love
Treehouse Guest TeacherAbhishek Gangadhar Nope, they can handle quite a few different time pieces.