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

I am having hard time answering this. Need help. Here's what I did: Write a function called far_away that takes a timedelta. Add that timedelta to datetime.datetime.now() and return the resulting datetime object. far_away() = timedelta + datetime.now() return datetime(2014, 11, 10)

2 Answers

Anthony Liu
Anthony Liu
11,374 Points

In the "Python Basics" course (Putting the "Fun" Back in "Function")section there is intro video going over functions

This site also explains python functions: http://www.tutorialspoint.com/python/python_functions.htm

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

You have to create a function, not just a variable named far_away. I'd heavily suggest going through Python Basics before you attempt Dates & Times.