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 trialMaximilian Richly
4,872 Pointsnot sure what I'm doing wrong
help, why is this not working??
import datetime
def minutes(dt1, dt2):
minutes = (dt2.seconds() - dt1.seconds()) / 60
return minutes
2 Answers
Kourosh Raeen
23,733 PointsHi Maximilian - The challenge is asking you to use timedelta.total_seconds()
to get the number of seconds. So start by the subtracting the datetimes to get a timedelta and then call total_seconds()
on that. Finally, after dividing by 60 pass the result to the round() function and return it.
Maximilian Richly
4,872 Pointslol, I got it to work. thanks.
Kourosh Raeen
23,733 PointsAwesome! Happy coding!
Maximilian Richly
4,872 PointsMaximilian Richly
4,872 PointsI tried that, but I'm still having trouble getting it to work. Can you give me an example of the right code?
Kourosh Raeen
23,733 PointsKourosh Raeen
23,733 PointsCan you post your modified code?