Date and Time - Bug/typo in "Hot Date", "Pretty Time" Section

The instructions say:
Print the current date in the form of mm/dd/yyyy.

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

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

I overlooked the second step, and Codeacademy accepted this:



from datetime import datetime
now = datetime.now()

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


Output:

2017/6/15
None

It should be updated to make sure the user checks if they rearranged the strings no? Like this:

from datetime import datetime
now = datetime.now()

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

Output:

6/15/2017
None

UPDATE: The next section, “Pretty Time” also allows arbitrary reordering of the strings contrary to the instructions.

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

2 Likes

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