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 trialJeffrey Huther
Python Web Development Techdegree Student 4,175 PointsCode Challenge: Time Tango: my code is not passing the challenge even though I can get it to work in PyCharm.
The following is the code I am using...What am I doing wrong? Thank you in advance
import datetime
def time_tango( user_date, user_time):
combine_time = datetime.datetime.combine(datetime.datetime.strptime(user_date,'%m-%d-%Y'),datetime.datetime.strptime(user_time,'%H:%M').time())
return combine_time
2 Answers
Steven Parker
231,248 PointsWith challenges, it's always best to "keep it simple".
Try a more minimal approach, perhaps something like this:
combine_time = datetime.datetime.combine(user_date, user_time)
Jeffrey Huther
Python Web Development Techdegree Student 4,175 PointsJeffrey Huther
Python Web Development Techdegree Student 4,175 PointsThank you Steven,
I got it to work. and I understand why it was not working for me. I was assuming the user/programmer would be passing date and time as strings. but the challenge was not assuming that ...
Thank you again