Code working but still shows error 4/6


#1

code
from datetime import datetime
now = datetime.now()
print '%s/%s/%s' % (now.month, now.day, now.year)
print '%s:%s:%s' % (now.hour, now.minute, now.second)

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

output
1/16/2016
22:52:19
None


#2

Hi remove the second print and all should be print on online like that mm/dd/yyyy hh:mm:ss. so your print should be like that print '%s/%s/%s %s:%s:%s' (......)


#3

it still shows the same error


#4

But the code iin the first post work fine


#5

its working now..... ty


#6

@wizmarco Yes, that outputs the desired result you’re looking for in the exercise and runs correctly. But they are also trying to teach you how to print variables that are integers by using the pad function.

from datetime import datetime
now = datetime.now()
print "%02d/%02d/%04d" % (now.month, now.day, now.year)

I personally messed this exercise up myself trying to give each separate part of the date a variable.
But i think importing the folder datetime allows you the respected arguments without having to do so.