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 trialHolden Glass
6,077 Pointswhat is the time_tango input format?
So have an idea on what is coming into the function but I want to make sure that I have the data right. It is a date and time object so the incoming date would be like datetime.date(2017, 3, 1), correct? And the time would be like date time.time(17, 1, 14, 197484) right? Some clarification would be nice. Thanks.
import datetime
def time_tango(date, time):
return datetime.datetime.strptime('{} {}'.format(date, time), '%m-%d-%y %H:%M')
1 Answer
Ryan S
27,276 PointsHi Holden,
Here is a hint: you might want to review the datetime.combine()
method.
Also, it is good to get in the habit of not naming your variables the same as python keywords or library objects. "date" and "time" already represent something in the datetime library. In this case it will pass, but it can lead to problems down the road as things get more complex.
Holden Glass
6,077 PointsHolden Glass
6,077 PointsK. Thanks. I'm starting to do a little bit of JavaScript and he just talked about names you can't use for variables because they are key words in JS.