Can I become a coder?
Our fortysomething writer rekindles his childhood passion for coding – but can he teach himself Python from scratch?
It worked. I couldn’t believe it, but it actually worked.
Stephen French and I had just spent all afternoon tapping code from a textbook into our computers – me into my Commodore 64, him into his Spectrum. It was probably no more than 20 lines of BASIC code, but once we’d typed it all out, run it, fixed the inevitable typos, finally got it to work and then saved it to tape, it had taken us all afternoon.
Being good programmers, we tested the code. He slipped a note through my letterbox, I ran upstairs, loaded my program and typed in the cryptic, handwritten jumble of letters. “Meet you at my house after The A-Team,” Frenchy’s message read, having been decoded by the Commodore 64. We were officially spies.
Admittedly, this basic, schoolboy encryption was some way short of 256-bit AES. I suspect the program merely substituted one letter of the alphabet for another, a code that – had we given it ten minutes and a Biro – even the cat would have cracked. But it was my first step into programming, getting a computer to do something other than play games, and I remember it like it was yesterday.
I settled on Python, the language that consistently appeared in all of the “10 programming languages you should learn NOW” articles I could find online. There was no shortage of books, online courses and apps willing to teach me. But could I actually do it? Could I reach a point where I could code something useful without setting foot in a classroom or lecture hall? I could, and here’s how.
Hitting the books
I’m a bit old school. I learnt most things from textbooks and good teachers, and it was a book that gave me the gentle shove I had been waiting for. To be precise, when Learn Python In One Day and Learn It Well appeared in the Amazon Prime Reading catalogue.
I’m immediately suspicious of any get-rich-quick-type title such as Learn Python In One Day. Nobody learns a computing language in a day, even if you had time to read all ten chapters and digest them. Nonetheless, I recognise we’re living in the age of clickbait and this kind of title helps shift books. And from skimming the first few pages of the book on my Kindle, it didn’t seem anywhere near as trashy as the title suggested.
However, a couple of chapters in and, having got my head around basic Python syntax, variables and lists, I wanted to put what I’d learned into practice with a few practical exercises. But this book didn’t seem interested in that, being more of a whistle-stop tour of the main Python commands and procedures.
I’m not knocking the book – it will stay on my Kindle and I’m sure will come in handy for reference as I progress – but it wouldn’t teach me how to code, let alone in a day. I needed something more structured, something that’s going to hold my hand as we shuffle into the complex stuff.
The online classroom
I decided an online course might be the best way forward, but where to start? There are so many online Python courses that you could spend a year just shortlisting them.
A number of forums had mentioned Microsoft’s free Python For Beginners course. It comprises 44 videos, co-hosted by a chap who sounds scarily like Kermit the Frog, and an interactive online course to go with it. That very much ticked the box of writing code as I learned, which is what I wasn’t getting from the book.
I watched the first ten or so videos, and although they were a little rudimentary to start with (if you need to be taught how to install apps on a PC, I’m not sure coding is for you yet), they gathered pace and I could follow along comfortably.
Your comprehensive guide to low-code
The missing component of your digital strategy - for developers and CIOs alikeDownload now
What put me off was the online tutorials. For example, in one you’re asked to write the code for a basic calculator – but all the examples of the code you need are on the previous page. When you flick back to see the code, you lose everything in the browser-based sandbox where you enter the code to the right. It didn’t like it when I had two tabs open at the same time, either.
Maybe I should have memorised the code from the previous page – it wasn’t blisteringly difficult after all. But I’m the kind of guy who works best with examples open in front of me as I type. And if I was stumbling on these basic tasks, I couldn’t see it getting better as the stuff got more complex. I needed another approach.
The best of both worlds?
In the end, I decided to go for a best of both worlds approach. After blowing out midway through the Microsoft course, I read a news story that Google was running a new online Python course for beginners via Coursera. That piqued my interest, not least because the last certificate I had earned was my Cycling Proficiency.
On a serious note, it seemed like that certificate could actually lead to gainful employment opportunities, but when I looked at the course syllabus my enthusiasm waned. It was largely pitched at people who wanted to use Python to administer IT networks and that’s not my bag.
However, elsewhere on Coursera, I came across Python for Everybody. This is a course delivered by the University of Michigan’s Dr Charles Severance and – handily for textbook-loving me – he’s written a book of the same title to accompany the course (or the other way round, I’m not sure which is the chicken and which is the egg).
That instantly appealed to me, as I could have the textbook open next to me on my tablet as I watched course tutorials or took on coding exercises myself. Better still, that book is free from the Python For Everybody website or only 99p to download on Amazon Kindle, which is a small price worth paying for not having to deal with the messy way Kindles handle PDFs.
The Coursera course is broken down into a series of “weeks”, with assignments to be carried out at the end of most weeks, although you can learn at your own pace. The first part is meant to take seven weeks, but I whistled through it in two.
The first part – or “specialization”, as Coursera dubs it – of this course basically follows the same structure each week. Us coders might call that a “loop”, with a “break” after week seven. You watch one or more videos, delivered by Dr Severance. You answer a ten-question quiz to make sure you’ve understood all of the concepts that have been explained. And then you take on a practical coding exercise that’s “auto-graded” by a piece of software. If that sounds clinically impersonal, it is, but Coursera has ways to bring the human element back into teaching, which I’ll come to later and that help justify the £37 per month you’ll spend doing this course on Coursera instead of doing much of the same material for free on Dr Severance’s PY4E website.
Dad jokes and daft hats
One thing that’s definitely not clinically impersonal is Charles Severance, or Dr Chuck as he calls himself (he’s @DrChuck on Twitter too). He sounds like Danny Concannon from The West Wing, doesn’t look entirely dissimilar and has the same easy-going style as the fictional reporter. He explains concepts patiently, bordering on laboriously, to make sure you don’t suffer from code blindness. He makes dad jokes, he occasionally turns up in silly hats, and he’s constantly slurping coffee as he delivers his video lectures – the latter of which sounds amateurish, but genuinely helps give the impression you’re sitting in a real lecture delivered by a real human being, not a presenter reading a polished script.
That’s further reinforced by watching him type code onscreen. I thought I was the worst touch-typist this side of Shanghai, but Dr Chuck knocks me out of the park. Coursera could have edited all those typos and mistyped commands out of the videos, but they’ve left them in and it helps you warm to a tutor who makes the same silly mistakes you do. If that’s deliberate, it’s subtly done.
The course isn’t perfect, occasionally leaving me stranded. As I mentioned previously, there’s a free textbook that accompanies the course, which is required reading. However, you’re largely left to work out for yourself which chapters you need to read before each week. You’ll get the hang of it after the first few weeks, but there have definitely been moments of head-scratching, when you’re expected to know something that’s not been covered in a video.
The graded exercises also had me thumping the desk in frustration once or twice. At the start of each exercise, you’re given instructions on what to do and given some sample code in the online editor to get you started. Yet that sample code isn’t always necessary or is occasionally even a red herring.
Worse, for me, is that you don’t always get to see how The Doc would have coded the exercise after you’ve completed it. I understand why they don’t want pupils sharing the code in Coursera’s online forums, because it spoils the exercises for people who haven’t done them yet, but once you have completed an exercise, it would be great if Coursera could email you Dr Chuck’s code and a short video explaining how he did it, just so you learn best practice.
I made this point on Coursera’s discussion forums and a tutor replied that: “There are multiple ways to write code and many different solutions can be both efficient and elegant. Which is why we also cannot give you one solution as a standard.” I get that, but I still feel that seeing an alternative way to crack the same nut would be beneficial.
That said, it’s clear that Dr Chuck and the course tutors don’t want to spoon-feed you everything. Coding is essentially problem solving; if they give you all of the solutions, it doesn’t encourage you to find alternative answers or better ways of reaching the same result yourself. As Dr Chuck himself says in one of his early lectures: “One of my whole goals in design of this class is for you not to try to rush through it, but to feel a mastery of it. And feel free to do the same problem over and over and over again, and hide the solution from yourself, until you realise, oh wait a sec, this is easy. Because frankly, up to this point and going forward, none of this should be very difficult. And you should really understand every single thing that’s going on in every one of the assignments.”
If you do find yourself staring glumly at a screen, failing to work out why a piece of code won’t deliver the desired result, you can upload it to the online editor and ask a staff member to take a private look via the discussion forums. They reply promptly, normally the same day, patiently explaining the error of your ways. On one assignment, my piece of code wasn’t running properly because I’d failed to de-indent a single line. It was both a relief and a punch-yourself-in-the-face moment when the tutor explained the problem.
This is the biggest drawback of distance learning. In another exercise, I methodically worked through a task where you had to import a batch of emails, run a search to look for a spam identifier string, strip out everything except the numbers at the end of those strings, convert them to integers and calculate an average. I took my time, solved each problem bit by bit, but got stuck on the final hurdle for a few hours. And what was my downfall? Not declaring the value of a variable at the top of the code instead of midway through. If I were sitting in a classroom with Dr Chuck, I’m pretty sure that he would have looked over my shoulder, pointed to the innocuous error and my stress levels would have remained sub-Trump. Instead, I beat myself up for a few hours, trying to rewrite perfectly good code that wasn’t working because of one small mistake.
But, determined not to rely on the in-house tutors once more, I did eventually work it out for myself. And although my cardiologist might disagree, that process will serve me well in the long run because there are not always going to be ready-made solutions to coding problems. I’m going to have to work through stuff. And it is exhilarating when you do manage to crack a problem by yourself, even if I may have to reinforce my office walls to prevent fists going through them for the preceding six hours of every task.
At the time of writing, I’ve just completed the first part of Python for Everybody and have the certificate to prove it. I’m currently midway through the second of five parts of the course, and it’s just starting to get interesting. We’re now importing and manipulating real data, starting to see how the previous eight chapters of theory might be put to good use. For example, I’m already thinking of ways I can take the masses of analytical data we get at the non-league football club I help run and use Python code to help spot trends. Likewise, I’m starting to think of Python scripts that might be useful for the tech website I publish. I’m keen to push on – the challenge is finding enough time to do so around the day job. (The irony of having to stick learning on the back burner so I can write a feature about teaching myself Python has not been lost on me.)
My Coursera certificate might mean nothing in the wider world. It’s not an accredited course, it won’t get me a job nor even a foot in the door. But as someone who has long yearned to learn how to code, it means something to me.
Navigating the new normal: A fast guide to remote working
A smooth transition will support operations for years to comeDownload now
Putting a spotlight on cyber security
An examination of the current cyber security landscapeDownload now
The economics of infrastructure scalability
Find the most cost-effective and least risky way to scaleDownload now
IT operations overload hinders digital transformation
Clearing the path towards a modernised system of agreementDownload now