Date and Time, 6.Grand final


#1

can anyone tell me whats wrong with my code ? i keep getting the same error: Oops, try again. Your printed date and time do not seem to be in the right format: mm/dd/yyyy hh:mm:ss

heres my code

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


#2

You were asked to print it in this format:

7/14/2016 23:38:4

And your code outputs:

7:14:2016
23/38/4

Do you see the difference? :slight_smile:


#3

sry looks like i messed up the copy past somehow... heres my code
from datetime import datetime
now = datetime.now()
print '%s:%s:%s' % (now.hour, now.minute, now.second)
print '%s/%s/%s' % (now.month, now.day, now.year)


#4

Ok.

You were asked to print it out in this format:

7/14/2016 23:38:4

And your code outputs:

23:38:4
7/14/2016

There are still not the same, right? :slight_smile: You have to change the order and combine both parts into one line.


#5

Adding on to what factoradic said, you may have to use a continuation "\"


#6

You are doing too much work. Read the instructions and follow closely