Nibbling at Python

Learning Python has been on my radar for many years. I have made a start at it a few times. The shell scripts, Applescript and even the Hypercard stacks I made back in the day are very useful but not quite enough any longer. Working with teams of software developers and tech support I have accumulated a lot of “what programming is and how it works” over the years, so this is not all new.

Recently I listened to another fine episode of Talk Python to Me, this time with Michael, Bob and Julian describing their latest course/adventure, 100 Days of Web. I like their style and the project intrigued me so I went and had a look and found Bites of Py Exercises.. and decided to jump in. I promptly discovered I had setup an account a year ago. Did I mention i’ve tried getting into Python a few times?

I’ve managed to complete 3 out of the 4 Intro Bites.. and with that under my belt, here’s a few things that are making it easier as I go along: I bounce around Google a lot trying to figure things out. The python documentation has lots of examples. Stackoverflow has answers for everything but can be hard to make heads or tails of. The team at RealPython made some fantastic tutorials which definitely helped me understand dicts enough to finish that Bite. But the best has been the Pybites Slack forum. I got really really stuck I went and talked to those folks and they pointed me in the right direction. Thanks!

Working in the browser is nice, but i’m used to using an editor on my own Mac along with all the tools it brings. So I asked.. and apparently I need to learn Emacs. Just kidding. VS Code and PyCharm are both good, along with downloading the Bites and the tests, using git and Github to store your code (and revisions!!!) from which you can then submit your answers. I was already familiar with these tools.. so I gave it a shot. They’re a great distraction from working on Bites. Fiddling with python versions, installing stuff, tweaking settings. Wheee! For now i’m going to stick to using the Python Interpreter on the command line to try things out until it works, then code in BBEdit and run the tests on the command line. Once they pass, I copy and paste the code into the web interface. It’s simple and does the job.

As to the Bites themselves? Hey, i’ve done 3 successfully! The first was hard as I really had no idea what I was doing and how the interface worked. I’ve never used tests before. I have expectations of seeing stuff print on screen but it never happened. I was confused! Eventually I figure out how to get it to work.. The second one? Well, as i’ve told my kids, “Programming is constant failure with the occasional success.” That one I got so frustrated I gave up and read the solution. Yes, you can discuss your solution with others once you give up or solve it. The third one I got eventually.. and the 4th is similar to it but just enough of a difference to throw you off. I felt like I was slogging through each Bite.

By now you’re wondering if I should abandon this as it’s not sounding like fun. Totally the opposite! I’ve learned a ton of new things, and i’ve got a better feel for how to get to the answer without all the distractions around it. Review the goal 4 or 5 times, make an outline of how I think it will work, look up a bunch of things, learn new things, poke around in IDLE until I can get a step to work, code it.. repeat! Eventually the tests pass. Woohoo! I really should be doing my job and instead I spent part of my morning having fun and learning Python. On to Bite 5!