Date and Time Grand Finale Issues


#1

https://www.codecademy.com/courses/python-beginner-en-zFPOx/0/6?curriculum_id=4f89dab3d788890003000096#

I need it to say the date and time in this format Month/Day/Year Hour:Minute:Second
but get this

ERROR: Oops, try again. Your code looks a bit off. Check the Hint if you need help! Your code threw the following error: 'str' object is not callable

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)

I've also tried this...

from datetime import datetime
now = datetime.now()
current_year = now.year
current_day = now.day
current_month = now.month
current_minute = now.minute
current_hour = now.hour
current_second = now.second
print '%s/%s/%s %s:%s:%s' (now.month, now.day, now.year, now.hour, now.minute, now.second)

and get the exact same ERROR as above.


#2

Look here:

You forgot the % when formatting. Thats the problem. Do you know where to put it?


#3

Oh WOW! It's always the tiniest things. It works great now. Thank you!


#4

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