Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMateo Rial
3,694 PointsI dont know why it doesnt runs like in the track
import datetime
answer_format = "%m/%d"
link_format = "%b_%d" #month name in the locale
link = "https://en.wikipedia.org/wiki/{}"
while True:
answer = input("What date you would like? Plase enter MM/DD format: ")
if answer.upper() == "QUIT":
break
try:
date = datetime.datetime.strptime(answer, answer_format)
output = link.format(date.strftime(link_format))
print(output)
except ValueError:
print("That not a valid date. plaese try again. ")
1 Answer
Julien riera
14,665 PointsHello,
What error do you have ?
Is this format written this way on purpose ?
link_format = "%b_%d"
Cheers,
Julien