Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
What I'm doing wrong here? can anyone please tell me what this 'round' does ??
import datetime def minutes(datetime1,datetime2): datetime1 = datetime.timedelta.total_seconds(datetime1) datetime2 = datetime.timedelta.total_seconds(datetime2) diff_in_min = (datetime1 - datetime2)/60 return round(diff_in_min)
Chris FreemanTreehouse Moderator 67,464 Points
You are on the right track, here are some hints:
- be mindful when subtracting.
datetime2is the “later” time and therefore has the larger epoch time
total_secondsmethod is only available on the
(datetime2 - datetime1)
(datetime2 - datetime1).total_seconds()is legal syntax but you may wish to assign the subtraction to a variable, then call the method on that variable.
the first and second statements reassigning datetime1 and datetime2 are not necessary. (I commented them out
Post back if you need more help. Good luck!!!
Thank you for the response. It helped me to solve the problem.