What is wrong with this code?


#1


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


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


#2

now.date does not exist. In that lesson I think you are meant to use now.day, not now.date. Hope this helped!


#3

Thank you! I tried your answer, and there is still a invalid syntax


#4

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

This time it is correct


#5

It works, right?

If not you might need a space after the second quote


#6

Im sorry but it doesnt work
it tells me every time "did you remember to print the now variable?"


#7

I tried copying and pasting your exact code into the lesson and for me it worked. I'm not quite sure what's wrong. The only lesson that has that error is the second one in that course. In that lesson you are not required to use the code that you posted.


#8

@fred.y.liu @kaazaar
print '%s/%s/%s %s:%s:%s' % (now.month,now.day,now.year, now.hour,now.minute,now.second)

You have to give proper spacing as mentioned in the instructions.
There is a single space between Date and time. So, In this code you have to give a single space before now.hour.
I hope this helps!


#9

This part is driving me crazy!^^ It doesn´t work.
could please post somebody the hole code so i can just copy it?
I promise i wont do it any more.. slight_smile:


#10

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)


#11

Kaazaar, you exact code worked for me, so I don't know what's wrong. If it's still not working you might want to contact codecademy...


#13

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