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 trialRaymond Clark
2,497 PointsReally struggling to understand this "timedelta minute" challenge. The way the instructions are written is confusing.
Write a function named minutes that takes two datetimes and, using timedelta.total_seconds() to get the number of seconds, returns the number of minutes, rounded, between them. The first will always be older and the second newer. You'll need to subtract the first from the second.
2 Answers
Steven Parker
231,275 PointsSometimes it might help to break the instructions up into smaller steps, for example:
- Write a function named minutes
- it will take two arguments, and both will be datetime values
- the first argument will always be older and the second one will be newer
- You'll need to subtract the first from the second
- since subtracting two datetimes creates a timedelta, you can use .total_seconds() to get the number of seconds
- you can then convert seconds to minutes
- then round the minutes to the nearest whole value
- finally return that minutes value
Does that help?
Raymond Clark
2,497 PointsThank you! I got it now. That really helped!
Steven Parker
231,275 PointsSteven Parker
231,275 PointsRaymond Clark — Glad to help. You can mark a question solved by choosing a "best answer".
And happy coding!