Python & Problem-solving

Scroll this

A part of me has always wanted to learn a programming language. But, like most people who have this thought, I have never prioritised it.

That all changed right at the beginning of the 3AI Master of Applied Cybernetics course, where the first fortnight in the Build course was focused on learning python.

Every fortnight, there’s a homework task to build skills through practice. This time, the homework took me a good month to complete, taking me through the basics of variables, expressions, boolean operators, conditionals, loops, functions, strings, lists, dictionaries and tuples.

Drawing back to my goals for this course, I have been driven to understand the tools and skills that others use in building cyberphysical systems in order to be able to meaningfully interrogate them. To that end, understanding how programming works, is a core part of the picture.

Given I am also really interested in how best to communicate what I’m learning to different audiences, I have also turned what I have learned into a ‘how-to’ video for other beginners trying to engage with their own project that involves python and circuits (see end of post for the video). This has been a new endeavour for me in terms of using OBS Studio for the first time to record my screen while talking. The focus of the video is an area that I learned a lot about through engaging with python in hands-on projects and believe can be useful for other beginners. It’s titled “How to organise your coding/making project for effective problem-solving and troubleshooting”.

Learning python is multifaceted. Below, I have summarised five core learnings that have stemmed from the experience.

1. Learning python means getting your hands dirty

The main way that I have learned python is through throwing myself into it. I have achieved a basic proficiency in python this semester through the following avenues:

  • Taking my time to do the 3A Institute python homework which gave a basic grounding in python
  • Doing an online course in python over 5 weeks with Stanford called “Code in Place”. In addition to online content, the course also had a weekly zoom with a tutor in small groups which I found very helpful
  • Learning from interrogating and questioning other people’s code – in particular we looked at a code for the Eliza chatbot (originally developed by Joseph Weizenbaum in 1966) as well as code for an engine for playing tic-tac-toe.
  • Learning from tutors and peers in doing homework and doing my own maker project.

Examples of code that I have developed include:
1) An Agent that played Tic-tac-toe according to a strategy that I set.
2) Code that articulates a lighting sequence that was executed in sync with code that played an audio recording through a FM radio transmitter.

I would classify my current python level as basic to intermediate proficiency and anticipate that this will continue to improve over the next semester as we build our own cyberphyscial system. I think the main method for improvement is to continue to practice using it and to observe others working with python to solve problems.

2. Languages are gateways into worldviews (and python is no different)

For me, learning python has been an important exercise in understanding the framing of a computer language. Like other language learning, immersing yourself in another language is a gateway into understanding the world differently. I have reflected further on the parallels between learning python and my experiences learning French in this blog post.

Trying to work practically with python beyond examples and towards building something that you’ve chosen exposed the different types of decisions that you make when coding. Specifically, it highlighted that there are decisions that can be made and there are decisions that must be made. Sometimes this distinction can be surprising. Through this learn-by-doing, I have uncovered that arbitrary decisions are context-dependent. That is, what you think is arbitrary now, may not be at a later date. Writing down what I’m learning as I’m going has been really important as a way of making explicit the decisions that have been made (particularly if they need to be revisited at a later date). The video below shares some examples of this in practice.

3. Understanding how to use Python ‘toolsis as important as the language itself

It took a while to get my head around the different tools that could be used, for example Integrated Development Environments (IDEs) or editors. I tried out several – Mu, PyCharm, Visual Code Studio and Thonny. Understanding how to best use these tools and what they can actually help you do was a whole other layer of learning. Watching others use these tools was really helpful for working this out. For example, whilst doing the online Stanford course I became familiar with PyCharm as this was the IDE used when working through examples in the weekly tutorials. I also found it helpful to watch the Build staff demonstrate with screenshare various questions to see how they navigated the tools.

Screenshot of weekly tutorial while doing Stanford’s course “Code in Place” – doing coding exercises “live” with a tutor in PyCharm

4. Learn-by-doing approach to python has its limitations

I’ve learned a lot about how python is taught – from the 3A Institute and from Stanford’s “Code in Place” online course. The overarching method to learning python in both of these scenarios has been learn by doing, that is, getting into a problem and experimenting with variables, functions etc in order to understand how to code. This approach has some limitations. For me, it often felt like I was at Chapter 10 of the book without having read the introduction.

This reflection led into a deeper investigation on what it is that we’re really learning whilst trying to code. I share these thoughts and learnings regarding computational thinking here.

5. Problem-solving and troubleshooting in python (and circuits) can be aided by good organisation

Throughout the semester, I had multiple conversations around ‘problem-solving’ and ‘troubleshooting’ code (and circuits) as core skills associated with learning python. What I found however, was that in addition to ‘learning-by-doing’ in terms of the actual code, I was also ‘learning-by-doing’ in terms of how to best troubleshoot and problem-solve.

Over time I realised that there are a lot of videos and websites out there talking about specific coding issues or how to resolve errors, but I didn’t find any on how best to structure what you’re doing so that you can actually problem-solve and troubleshoot effectively.

The video I have created below serves to fill this gap. It’s intended for beginner audiences that are trying to organise their coding/maker projects in a way that can help them problem-solve and troubleshoot. It’s a compilation of my learnings to date on this particular area and could potentially be useful for future cohorts that are embarking on the world of python and maker projects with a beginner mindset.

A video on my learnings about how to organise a coding / maker project for effective problem-solving and troubleshooting

More reflections as part of the Build Learning Portfolio: