How Do You Learn Python?

David Jones
22 August 2019 12:00

The RSE team has a recurring interest in learning Python: Because we take on new staff and we want to train them, because we want to enhance the skills of our existing staff, because we deliver training courses, and because we are often asked for our advice on how others should learn Python.

Python is one of my favourite tools for solving computing problems, and I use it day-to-day, but I’m not involved in the learning and teaching of Python so much. I learnt Python so long ago that my personal experience isn’t that much use.

So I used my Twitter network. You are all very helpful and my tweet where I ask how you learnt Python got a lot of useful replies and suggestions.

a laptop showing some code, taken between the shoulders of
people huddled coding

I have to preface this with a warning. If you’re setting out to learn Python today, you should absolutely learn Python 3, and preferably the latest supported version, which is Python 3.7. The oldest version of Python that is currently supported is Python 3.5 (4 years old), but support for that is likely to end in a year or so. Be suspicious of any resource which hasn’t been updated for more than 3 years.

The overwhelming impression is that there are a lot of diverse resources out there for people wanting to learning Python. I specifically asked on Twitter because I don’t know the answer. In summarising the responses, I am pointing out the things that have multiple mentions, or that I have some personal reason to know are worth including.

Don’t worry if you can’t program. Programming is fun and rewarding, and many of the approaches here are completely suitable for people new to programming.

Tactics and resources

There are roughly 3 approaches: video, books, self-taught. Obviously these can and are used in combinations too. Not entirely absent, but certainly not common in the responses, are taught courses or workshops. Only a couple of people mentioned learning Python as part of their university or college course. There are also other courses outside of the formal higher-education system: Django Girls, Software Carpentry, commercial offerings from independent operators; but no one mentioned these or said “I went on a course at PyCon” or anything similar.

One strong theme that cuts across the mode is “I had a project/thing in mind, then…”. There is no doubt that a domain-specific problem is a good motivator for learning a programming language. People build things like expense apps, web shop-fronts, and Sims character generators.

One tactic is switching to Python within an existing programming job. Obviously this is not an option available to everyone, but it is worth considering if you can be assigned (or assign yourself?) to a Python project at work. No doubt that doing it as a job simplifies the task of deciding what to work on while you’re learning.

If you are having problems deciding what to work on while you’re learning, you might like to try a coding challenge. These challenges are usually set-up as a series a problems, generally getting progressively harder, but often with the ability to skip or peek ahead if you get bored or stuck. There are a few available, but the ones that were mentioned are Project Euler which is very well known and fairly mathematical, and Rosalind which has a strong bioinformatics slant—my followers and nearby network are probably enriched for biologists.

Lots of people are self-starting learners, echoing Emily Gorcenski’s recent tweet about starting college this year:

Almost everyone mentions “something” plus: Google / Stack Overflow / the docs / YouTube / trial-and-error. No doubt that being able to research and discover solutions to a problem using the general web is a Force Multiplier. Making you a better learner in both self-paced and instructor-taught situations.

Video

The rise of video is plain to see in the replies. To summarise several people: “heard about a thing, YouTube a thing, did a thing”. There are a variety of video platforms from the generic YouTube to specialist educational platforms, and including a couple of single-source varietal video producers. Of the generics, only Udemy got mentioned more than once. The only named video stars to get mentioned multiple times were Python talk circuit regulars Raymond Hettinger and David Beazley.

Of the small-batch producers, @talkpython (podcast and training videos), got multiple mentions.

Written Materials

Quite a few suggest the official Python tutorial. I learned from it (a decade ago) so I have a certain fondness for it. I’ve heard mixed reviews of it over the years, so I gave it a very brief flick through. It’s dry but fairly comprehensive, sometimes with bizarrely uneven coverage.

Python has a problem, and that is: How do I install it and start it? This tends to be very difficult to describe in a comprehensive way in tutorial materials (so many options, so many different operating systems, many of which will be become obsolete quite quickly). Hence lots of tutorials tend to have quite messy and difficult to follow prologue sections, and the official tutorial is no exception.

Alongside the tutorial, the official Python documentation is worth mentioning (as several respondents did).

The books with multiple mentions were: Think Python, a for-money book and a free PDF; «Learn Python 3 The Hard Way» which I haven’t read but I know has a reputation for being both hard and controversial (and reasonably popular); Automate the Boring Stuff with Python an Al Sweigart book also free-to-read from their website; «Python Cookbook» has a new edition in the works, so might be worth waiting (on the other hand, previous editions have been so popular that you might be able to find one literally lying around your office)—note that the book isn’t a tutorial, but is a book to grow your Python skills; «Fluent Python» got the most mentions, but I’ve never read it, nor spoken directly to anyone who has.

Let’s Get Physical

Physical computing has repeated mentions. There are lots of platforms and communities supporting this, Raspberry Pi and the Raspberry Pi Foundation are doing great work here, as are micro:bit, powered by MicroPython. Lots of local Maker and Python groups, including our local Python Sheffield, will do introductory sessions, so keep an eye out.

PyCon UK has a children’s day which is great way to introduce young people to Python and physical computing. It’s fun, extremely affordable, and the show-and-tell in the main hall at the end of the day is one of my favourite parts of PyCon.

Wrapping up

So you want to learn Python? I would set aside roughly 48 hours, and divide that into 24 hours of “studying materials” and 24 hours of “typing in Python programs”. In the context of a taught course that would be 3 hours taught a week plus 3 hours homework for 8 weeks. If you’re learning at home, or doing a crash course, it won’t fall into the same 8 weeks, but I think the hours are roughly right.

I think you may as well start with the Python 3 tutorial. It’s written by the people that make Python, and it’s part of the documentation which you’re also going to be reading. If you get bored or decide it’s not for you, try one of the suggestions above; there are cost-free options as well as suggestions for those with a budget. If you don’t like the look of those, feel free to mine the replies to my tweet.

Good luck, and let me know how you get on!

If you get stuck and need a helpful nudge, get some advice at our Code Clinic.

Contact Us

For queries relating to collaborating with the RSE team on projects: rse@sheffield.ac.uk

To contact the RSE team about seminars, training or JADE: rse-team-group@sheffield.ac.uk

Join our mailing list so as to be notified when we advertise talks and workshops by subscribing to this Google Group.

Queries regarding free research computing support/guidance should be raised via our Code clinic or directed to University central IT support.