Date and Time - Grand Finale


#1

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)

Apparently its is wrong and i dont know how because the place where it prints out is fine.

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

Thanks

oh yh also yes i did reset the course :grinning:


#2

We need to print this altogether. Basically, combine this to one print statement.


#6

from datetime import datetime

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

this the problem I got when present my code . can you help me out
Oops, try again. Your code looks a bit off. Check the Hint if you need help! Your code threw the following error: not all arguments converted during string formatting


#7

Not all strings were converted during formatting; so count how many %s tokens you have in your print statement compared with the amount of date/time-types that you’ll be inserting into your string.

See, it’s not the same amount.

Next time, instead of interrupting someone else’s topic, you can create new topic like its stated in the Guidelines. Thank you! :slight_smile:


#8

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