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) Dates and Times Timedeltas

How can I write something that passes the timedelta quiz? I don't have a clue as to what they are asking . . .

Here are some things I have tried: datetime.timedelta(min = -5) datetime.timedelta(days = -(1/24)*(1/12)) datetime.timedelta(seconds = -300) datetime.timedelta(days = -1/288) etc.

I have been very inventive but nothing works. Very explicitly now, what on earth can I write??? I have spent a long time on this.

Michael Pastran
Michael Pastran
4,727 Points

can you post your code? so i can see what is the challenge your stuck on

3 Answers

OK, the answer appears to depend on what computer I'm using. The one at home tells me that the (minutes = -5) is fine, but the one where I'm supposed to be taking this class, says Bummer! no matter what I do.

Michael Pastran
Michael Pastran
4,727 Points

Ohhhhh!! i get it, its the quiz not a challenge. you had it right the first time Paul. the only thing is that "min = -5" is not correct. if you looked at the documentation for datetime. you would see that for minutes you have to actually write "minutes" so the answer for that question is

datetime.timedelta(minutes = -5)

I did look at the documentation, and that is one of innumerably many things that I tried, and it didn't work. That is why I put "etc.", because I spent about an hour trying different permutations and combinations of things. How many things can one make up in an hour? A lot . . .

I did try minutes (as in minutes = -5), as well as minute, min, "min", 'min', 'minutes, "minute", etc.

(minutes = -5) (min = -5) ("min" = -5) ('min' = -5) (minutes' = -5) ("minute" = -5) (minutes=-5) (min=-5) ("min"=-5) ('min'=-5) (minutes'=-5) ("minute"=-5)

. . . and on and on, seemingly without end, repeating the four questions on the test over and over and over again.

And I tried lots of permutations of hours, days, and things like (days = -1, seconds = 86100) and (days, seconds = -1, 86100), etc.

I just don't have even the slightest clue what to do here.