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.

Python Dates and Times in Python Dates and Times Timedelta Minute

David Hernandez
seal-mask
.a{fill-rule:evenodd;}techdegree
David Hernandez
Python Development Techdegree Student 5,104 Points

Not understanding what is being asked here, completely lost on this question and can't get past it.

Not understanding what is being asked here, completely lost on this question and can't get past it.

minutes.py
import datetime

def minutes(start_time, end_time):
    delta_seconds = (start_time - end_time).timedelta.totalseconds()
    print(delta_seconds)
    return round(delta_seconds / 60)

1 Answer

Steven Parker
Steven Parker
216,891 Points

You're prety close, but:

  • you won't use the term "timedelta" — the result of the subtraction is a timedelta.
  • the name of the method is "total_seconds" (with an underscore)
  • the instructions say to "subtract the first [argument] from the second"
  • the function doesn't need to print anything
David Hernandez
seal-mask
.a{fill-rule:evenodd;}techdegree
David Hernandez
Python Development Techdegree Student 5,104 Points

Thank you! I was able to figure it out once I stepped away and then reread. I noticed the number too was close but negative. I appreciate the support.