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 trialEric Hodgins
29,207 PointsWrite a function named time_tango that takes a date and a time. It should combine them into a datetime and return it.
Has anyone tried this question? I can't figure it out. Are 'date' and 'time' strings when passed in?
Any help is appreciated!
Thanks, Eric
4 Answers
boog690
8,987 PointsThe two parameters date and time are not strings, they are date and time objects. The package datetime actually has a method called combine which is used when we want to combine a date object with a time object (into a datetime object). Return the two objects combined.
I linked to the combine method. I won't give the answer away but hopefully you can figure it out from the datetime documentation. Best of luck!
Wolverine .py
2,513 Pointsimport datetime
def time_tango(date, time):
return datetime.datetime.combine(date, time)
just got past with this code :)
Eric Hodgins
29,207 PointsThanks! That did the trick.
micram1001
33,833 PointsThanks forgot the combine(date, time)