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 Time Tango

FHATUWANI Dondry MUVHANGO
FHATUWANI Dondry MUVHANGO
17,796 Points

problems with combo

any problems with my code, coz i cant see any

combo.py
import datetime

def time_tango(date, time):
    return datetime.datetime.combine(datetime.date.today(), datetime.time())
Jose Mena
Jose Mena
Courses Plus Student 18,978 Points

They are passing you the datetime objects in the function, so your return statement should just be

return datetime.datetime.combine(date, time)

What you are doing is creating new objects combining them and returning that, not even touching the date and time objects passed to you

1 Answer

Had a similar problem,

you defined the function very well. The problem is that you are combining two different things than what you have as arguments of your function. Simply combine those you will be fine. Check the .combine method it has two attribute that must be given one of date and the other of time. Syntax>> https://docs.python.org/2/library/datetime.html#datetime.datetime.combine so try; ''' Python

import datetime

def time_tango(date,time): tango = datetime.datetime.combine(date,time) return tango '''