Python Dates and Times in Python Dates and Times Wikipedia Links

Is it bad that I couldn't figure this out on my own

I tried doing it myself as the homework before checking this video and I couldn't figure it out. Do you think that I am behind?

Joel Sprunger
Joel Sprunger
4,510 Points

I do not have access to the problem. All I can see is the title and your question. This is a frustrating Treehouse "bug". You ask a question and it is easy to assume that everyone has access to what you are looking at. This gives me a path Python > Dates and Times in Python > Dates and Times > Wikipedia Links, but if I click on the path it doesn't take me to the content you are looking at. Please be more specific.

3 Answers

Joel Sprunger
Joel Sprunger
4,510 Points

No that's fine. Half the time I try to figure it out before watching the video I screw something up. But I think the exercise of trying first really does help you learn, because it shows you where you were thinking incorrectly. When you just start by watching a solution it is easy to follow along and feel like that is the natural logical solution. If you then watch the video and that doesn't make sense, you should probably dig further back into prior videos, or check other resources to clarify.

Mark Sebeck
Mark Sebeck
Treehouse Moderator 26,461 Points

No Aizah it is not bad. If you knew how to do everything you wouldn't need to be taking these courses. Try your best then watch the solution and code along with the solution. If at the end of the course you don't feel you understand it take the course again. You will find that you understand a lot more the next time. Good luck and happy coding.

Sorry for the inconvenience! It is a video titled Wikipedia links

This is the code used in the video

import datetime

answer_format = '%m/%d'
link_format = '%b_%d'
link = '{}'

while True:
    answer = input("What date would you like? Please use the MM/DD format. Enter 'quit' to quit. ")
    if answer.upper() == 'QUIT':

        date = datetime.datetime.strptime(answer, answer_format)
        output = link.format(date.strftime(link_format))
    except ValueError:
        print("That's not a valid date. Please try again.")