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!
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 trial
Pranshu Mittal4,276 Points
I am not able to identify the error in my code
I am getting the desired output when i run the same code in Jupyter Notebook, but here it says Try Again! Could anyone tell me what is the problem with my code?
import datetime def minutes(): now = datetime.datetime.now() today = datetime.datetime.today() - datetime.timedelta(hours = 5) timediff = now - today seconds = datetime.timedelta.total_seconds(timediff) total_diff = round(seconds/60) return total_diff
Steven Parker228,095 Points
Where the instructions say "Write a function named minutes that takes two datetimes...", they mean that the function needs to have two parameters and the caller will be providing both values as arguments.
The comparison needs to be done on the passed parameters and you won't need to sample the current time/date at all.