Hot Date

<Below this line, add a link to the exact exercise that you are stuck at.>
<In what way does your code behave incorrectly? Include ALL error messages.>
Did you remember to use the % to print the strings? Look at the example for help.
<What do you expect to happen instead?>


from datetime import datetime
now = ()
print now
print now.month
print now.year
print str(now.month) + str("/") + str( + str("/") + str(now.year)

<do not remove the three backticks above>

It want’s you to format a string in like this:

print "Hi my name is %s!" % (name)

The idea is to use templating to create the desired output string.


    a = 3
    b = 4
    c = 5
    print "height: %s, base: %s, hypotenuse: %s." % (a, b, c)

Notice how the %s are placeholders in the template string? The order in which the variables are listed in the tuple is the order they fit into the template. Since a, b, c are type int, we could write %i. For this example %s is fine, and what to use in your solution.

can someone please just give me the answer? im so confused

from datetime import datetime
now =

print '%s-%s-%s' % (now.year, now.month,
# will print: 2014-02-19

Only two things need to change for the example to fit the solution.

what is wrong with my code?

Check the error message closely:

Your printed date doesn’t seem to be in the proper format: mm/dd/yyyy.

You’re getting closer…

I still dont understand. Im sorry for any annoyance but i suck at coding

The expected format does not have dashes. What does it have in their place?

i dont know! help please

slashes!! how do i get slashes? thanks so much for all of the previous help

1 Like

Forward slash on a typical US keyboard is on the same key as the ? mark. If your device has a limited keyboard, then it may take a sequence to produce that character. Let me know if this is something we should look into. Might have to call the help of another member.

If nothing else, copy this and paste it: /.

thank you so much mtf!!!

1 Like