Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Dates and Times in Python Dates and Times strftime & strptime

Andy Hughes
Andy Hughes
7,148 Points

Not helpful, creating a coding challenge when video is all console.

Maybe I'm a lone wolf, but hopefully not.

I've spent around 3hrs trying to get the solution from this code challenge. It seems whatever I did, nothing worked. I tried using the example notes at the top of the code challenge, but no matter how I tried to enter parameters, nothing worked.

So then I checked out community member answers and found a whole bunch of people having the same problem. Eventually, I figured it out from a combination of different people's attempts. So why am I telling you this? Because I'm frustrated!

I realised that all the videos from Kenneth (who I enjoy watching so no disrespect to him) show him coding things in the REPL/Console (whatever it's called) and yet the code challenge is in the code editor. Then I realised, not once had there been a demonstration of coding it in the editor. It's different, it just is. Maybe not to those who are pros at this, but to me, it's written and handled differently.

So my brain was trying to think about what Kenneth had coded in the console, which doesn't match how you'd physically code it in the editor using functions etc. At least, that's what it feels like to me. If I'd have seen how it's coded in use, I might have solved it quicker.

Python is about being clear and simple, yet some of the videos I've watched are anything but. I get that we need to be able to think and figure stuff out for ourselves, but as a newbie coder doing a 'Basics' course, it's quite demotivating getting stuck so often.

Please, if you're going to expect us to code something in the editor, show us examples that help us to do it quickly. Then we can practice it over and over. Please don't make it a puzzle in itself, just trying to figure out what we don't know and haven't seen.

## Examples
# to_string(datetime_object) => "24 September 2012"
# from_string("09/24/12 18:30", "%m/%d/%y %H:%M") => datetime
def to_string(fish):
    return fish.strftime("%d %B %Y")

def from_string(date, format1):
    return datetime.datetime.strptime("24 September 2015", "%d %B %Y")
Jeff Muday
Jeff Muday
Treehouse Moderator 26,998 Points

Yeah, sorry about that. It's great that you took the time to solve it.

It is a great practice to have to look at the forums, documentation, Stack Overflow, and even YouTube. You will be doing it almost every day you're coding as well as contributing to forums and possibly Stack Overflow as you figure things out.

The code challenge environment is pretty robust, but "nit-picky" at times and far from perfect. Give the code challenges your best effort-- but don't ever let a code challenge stop you from moving forward! Always ask for help, and don't be afraid to give constructive help to others.

Good luck with your Python journey!

1 Answer

Andy Hughes
Andy Hughes
7,148 Points

Jeff Muday - totally get what you're saying. I am constantly flipping back through the videos, checking other community members attempts as well as trying it on my own. Much of the time, this gets you to an answer.

However, it can be seriously soul destroying sitting there thinking "I must just be plain dumb because I watched the video yet I still can't figure this challenge out. Even after I've tried it multiple times in multiple ways". I'm sure it's not just me that's felt like that.

The result of this feeling can lead to people entering what I call in coaching "The Give Up" zone. It becomes far easier to skulk away like it was all a bad dream, than continue feeling like you're just not good enough.

It sometimes feels to me like the challenge tasks are written like a text book on quantum physics when in reality all they are asking for is the author of the book. I'd prefer see, do, repeat to help me understand and then repeat over again till it sticks.

But I guess we all learn differently :)