Date and Time error


Can someone help please?

from datetime import datetime
now =

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


So to correctly "format" the print statement you need to instead of having individual quotes around your %s you need to just have one set of " " around them. So for example:

print "%s/%s/%s %s:%s:%s"


Thank youuu :smiley: I was trying to solve this problem for like 20 minutes!


Yeah I hate when I solve something correctly but I forgot a small puncuation mark or misspelled something so I completely understand xD Your done with this section now so on to Conditionals and Control Flow so have fun and happy coding! :smiley:


and also can you help me with this one also I am a beginner so I could be making some amateur mistakes :/.

def greater_less_equal_5(answer):
if 5 - 4 :
return 1
elif 6 - 7:
return -1
return 0

print greater_less_equal_5(4)
print greater_less_equal_5(5)
print greater_less_equal_5(6)

It sais the second statement "elif" is wrong I couldn't understand why


Pay attention to the instructions where it says answer greater than or answer less than... notice you have a parameter that is named answer... that should hint you into the right direction :smiley:


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