Error in Data and Time 6 in Python course


#1
from datetime import datetime
now = datetime.now()

print '%s/%s/%s %s:%s:%s' % (now.month, now.day, month.year, now.hour, now.minute, now.second)

The above is the code I used and below is the error I receive. Any advice on what I am doing wrong?

Traceback (most recent call last):
File “python”, line 4, in
NameError: name ‘month’ is not defined

Thanks!


#2

Hi @devpro63336,

let’s focus on this line here:

Did you see the error? What is month.year? Where did the instructions ask for that?


#3

@intermediategamer thank you, I was focused on the first term (now.month) and overlooked the rest…:confounded:

Thanks for the help!


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.