Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
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 Parker210,130 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.