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 trialDevin Scheu
66,191 PointsDate Time Python
Write a function named time_tango that takes a date and a time. It should combine them into a datetime and return it.
Ive been having a very hard time with this.
4 Answers
Mario Blokland
19,750 PointsYou almost have it.
The problem is that you try to call a function named combine
inside the datetime
module. But there is no combine
function inside that module but a combine
method (methods are called on instances/objects and functions don't).
What you should try to do is call a method named combine
, which is inside a class named datetime
. And the class datetime
is inside a module which is also named datetime
.
To not trying to confuse you too much, you only forgot one word in the return line. Do you see it?
Let me know if you need some more help but I think you will get it :D
Jose Luis Lopez
19,179 Pointsimport datetime
def time_tango(date, time): return datetime.datetime.combine(date, time)
This is what it worked for me
Kenneth Love
Treehouse Guest TeacherCheck the docs for the combine()
method.
Devin Scheu
66,191 Pointsimport datetime
def time_tango (date, time):
return datetime.combine(date, time)
What am I doing wrong, sometimes I confuse syntax's between language.
Mario Blokland
19,750 PointsMario Blokland
19,750 PointsHi Devin,
could you tell us what you have done so far?