Grand Finale Error


#1



https://www.codecademy.com/courses/python-beginner-en-zFPOx/0/6?curriculum_id=4f89dab3d788890003000096#


Oops, try again. Your printed date and time do not seem to be in the right format: mm/dd/yyyy hh:mm:ss


Giving me the above error I don't know whats wrong with the code any help welcome


from datetime import datetime
now = datetime.now()

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


#2

Hi @masteranonymous007 ,

Compare the format of your output with the format specified in the instructions and in the message.

The required output format is ...

mm/dd/yyyy hh:mm:ss

Note the specified placement of slashes and colons.

Currently, your format string is ...

'%s/%s/%s/ %s:%s:%s:'

#3

But everything seems right the slashes and colons are also in the correct places. the date is 08/09/2016 which is in my output. I actually cannot find anything wrong with it.


#4

@masteranonymous007 ,

Yes, as you point out, the current date is 08/09/2016.
But in the console, you have it output as 08/09/2016/.

Check the format of the time, as well.


#5

Ah I see. I will try and inform you in a second


#6

Worked. Yup I put an extra slash and colon I thought it had to be after each string. Thanks


#7

But why do you not put a slash or colon on the last string?


#8

Hi @masteranonymous007 ,

In dates and times, slashes and colons, respectively, are used to separate the components, but not to terminate them. Therefore, they are not needed after the final components of dates and times.


#9

That clears it up cheers lad


#10

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