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 Far Away

function called far_away challenge

im not sure i did not understand the concept or its something else. please help!!!!

far_away.py
import datetime

def far_away(timedelta):
  datetime.datetime.now() + datetime.timedelta(hours=5)
  return datetime.datetime

1 Answer

Dan Johnson
Dan Johnson
40,532 Points

You're already being sent in a timedelta so you don't need to create a new one. You'll also need to either save the result in a variable or return it right away.

# Save for a return
result = datetime.datetime.now() + timedelta

On a side note, this:

return datetime.datetime

will return the class itself rather than a new datetime instance. So if you used the first example you'd want to return result instead.

thank you