Please Help, AGAIN


#1

Again, I need help. I tried to follow the instructions but it didn't work out so well.
Here is the code:

from datetime import datetime
now = datetime.now()

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

print mm/dd/yyyy

please let me know where I went wrong:slight_smile:


#2

Assuming you are on Lesson 4: https://www.codecademy.com/en/courses/python-beginner-en-zFPOx/0/4?curriculum_id=4f89dab3d788890003000096

I'll break down the instructions for you:

Print the current date in the form of mm/dd/yyyy.

They want the STRING in the FORM of mm/dd/yyy. Not literally mm/dd/yyyy. So your string should print the month first, then day, then year like this: "03/29/2017". Hence you don't need that print mm/dd/yyyy in your code (last line).

Change the string so that it uses a / character in between the %s placeholders instead of a - character.

Ok, you've done that.

Re-arrange the parameters to the right of the % operator so that you print now.month, then now.day, then now.year.

Seem like you messed up the order as you are printing now.year, now.month, then now.day. BUT they want now.month, now.day, and then now.year to follow the format of mm/dd/yyyy. You are printing a format like yyyy/mm/dd.


#4

Just a little problem, The Sequence.
First month , then day and finally year.

print "%s/%s/%s" % (now.month, now.day, now.year)


#5

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