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 trialKevin Mai
8,049 PointsCan anybody please post up the code to this challenge? This is what I have. I can't find the problem to this code.
Help please.
import datetime
def time_tango(date, time):
combined = datetime.combine(datetime.date(date), datetime.time(time))
return combined
3 Answers
kwhitlock
8,918 Pointsimport datetime
def time_tango(date, time): combined = datetime.datetime.combine(datetime.date(date), datetime.time(time)) return combined
Ken Alger
Treehouse TeacherKevin;
The datetime
module in Python also has a datetime
class that needs to be used. Then, inside the combine()
method you need to pass in the arguments given to time_tango
.
You can also simplify your code a little bit and simply return the value directly without assigning it to a variable. In other words you could do:
return answer
instead of
combined = answer
return answer
Post back if if you are still stuck.
Ken
Kenneth Love
Treehouse Guest TeacherYour date
and time
arguments will already be datetime.date
and datetime.time
objects, so you don't have to cast them.