Question with datetime


#1

from datetime import datetime
now = datetime.now()

print '%s/ %s/ %s' % (now.month, now.day, now.year)


error: Did you remember to print the now variable?

I do not know how to fix this problem?


#2

Hi @yokiaayuxi,

For which one among the six Date and Time exercises did you submit this code?


#3

Getting the Current Date and Time


#4

For the Date and Time 2. Getting the Current Date and Time exercise, instead of this ...

print '%s/ %s/ %s' % (now.month, now.day, now.year)

... just simply display the value of now, as follows ...

print now

Regarding the code that you posted, upcoming exercises will require you to display the various components of the date and the time. For each exercise, the submission correctness test (SCT) will require strict adherence to the format specified in the instructions. For example, no spaces should be included in the output that are not called for in the specifications.


#5

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