Can't figure out Hot Date


#1

I don't know what I am doing wrong

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

Traceback (most recent call last):
File "python", line 4, in
TypeError: not enough arguments for format string

I don't know what I am doing wrong

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

#2

Can you include your code please?


#3

We can't go through the link to see your code we can only see our code for that lesson so posting your code is important to help us look at your code and see what the problem is and help you solve it. Even with that said I will try and help you now.

Assuming you have the from datetime import datetime and now = datetime.now() all done pat lets take a look at our instructions and example for how to solve this lesson.

Example from Lesson:

print '%s-%s-%s' % (now.year, now.month, now.day)

In fact, if it wasn't for the change in instructions you could have just copied and pasted the example from the lesson into the lesson to pass! Thankfully, smart people make these lessons not me! Anyhow, the example above is a perfect example of structure and how to build your code for this lesson.

1.) Change the string so that it uses a / character in between the %s placeholders instead of a - character.
So what do we do? Go back to our example, change the - to / and you have your code! No trick!

print '%s/%s/%s' %

The lesson also gives a good explanation of the code set up. "Remember that the % operator will fill the %s placeholders in the string on the left with the strings in the parentheses on the right."
So now lets fill that right side shall we?

2.) Re-arrange the parameters to the right of the % operator so that you print now.month, then now.day, then now.year.
Once again reference your example given to you and you should be able to see that you just copy that same format in a different order. So first inside of your () you need now.month now.day and now.year. So it should come out to be something like this:

(now.month, now.day, now.year)

Notice the commas! They are important!
Now combine the two steps on the same line and you should pass with flying colors! :smiley: Sorry if this seems childish in explanation I just know if I can explain it to a child I can explain it to adults so cheers! and I hope this helped!


#4

sorry about that! thanks a lot for helping! it worked


#5

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