<Below this line, add a link to the EXACT exercise that you are stuck at.>
Print the date and time together in the form: mm/dd/yyyy hh:mm:ss.

To start, change the format string to the left of the % operator.

Ensure that it has 6 %s placeholders.
Put slashes and colons and a space between the placeholders so that they fit the format above.Then, change the variables in the parentheses to the right of the % operator.
Place the variables so that now.month,, now.year are before now.hour, now.minute, now.second. Make sure that there is a ( before the six and a ) after them

<In what way does your code behave incorrectly? Include ALL error messages.>
this is my code
from datetime import datetime
now =
print ā€˜%s/%s/%sā€™ % (now.month,, now.year)
print ā€˜%s:%s:%sā€™ % (now.hour, now.minute, now.second)

<What do you expect to happen instead?>
my error states
Your printed date and time do not seem to be in the right format: mm/dd/yyyy hh:mm:ss
what did i do wrong??

Replace this line with your code. 


In this question, anyway, you used two print statements when only one was expected.

Write everything into one format string, and group all the arguments in the parameters. You can use \ as a line break and use two lines to write the code.

print " ... " % \
( ... )


can you give me an example please


Start with the intended format and set out the placeholders

 mm/dd/yyyy hh:mm:ss
"%s %s %s   %s %s %s"

Now fill in the printable characters and adjust spacing.

"%s/%s/%s %s:%s:%s"

Next we can create the tuple that holds all the arguments.

(now.month,, now.year, now.hour, now.minute, now.second)

And now combine to form the print statement:

>>> from datetime import datetime
>>> now =
>>> print ("%s/%s/%s %s:%s:%s" % \
(now.month,, now.year, now.hour, now.minute, now.second))
10/8/2017 18:42:12


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