How To Learn To Program In Python

By Jamie McSloy / May 30, 2017
brain stuff category image

How To Learn Python Programming

Do you want to learn an in demand skill that’ll get you a great job or potentially help you build a tech start up (or something equally interesting)?

If so, then this article will help you. It’s obviously outside my usual remit, but it’s handy and comes from personal experience and maybe some of you will get some crossover benefit.

Why Learn Programming, And Why Python?

I’ve talked about the automation apocalypse before. Whether you subscribe to the idea that everything is going to be automated (it is) and whether that’ll be the basis for any new economy (it will) or you don’t; the fact is that programming is going to be important now and for the foreseeable future.

Now, you’re probably not going to be one of these fourteen-year-old whizz-kids that’s hacking the CIA any time soon. For one, you’re probably more than fourteen already. For two, super-programming savants probably won’t find their way to this site, because they’ll be obsessively programming already. Becoming a genius hacker is outside my ability to teach anyway.

But if programming is important and you don’t know how to program at least a little, then you’re like the older parent who won’t let their kid have a computer because you don’t know how “The Facebook” works.

Ignorance isn’t an excuse. You’re either on the train or not.

That’s why you should learn programming.

(Time Out: If you’re enjoying this article, then you should probably sign up to my mailing list, where I give out ideas and business tricks that I don’t share publicly. Click here, fill out your details and get yourself on the list! You won’t leave this page.

Now Back To The Regular Programming Schedule…)

Why Python?

Python is a language with pretty easy syntax (or code) to follow. It kind of makes sense. It’s also got a wide range of uses, it’s pretty popular and it has big libraries available (we’ll talk about why that’s important later.)

It also serves as a jumping block to less-easy programming languages. Also, if you’re interested in programming for hardware, Python is often used for that too.

Let’s get on with how to learn.

The Basics

I recommend two books that are great whether you’re a veritable programming genius, or you’re a complete novice.

Those “books” are Learn Python the Hard Way and Think Python.

Now, here’s a weird truth; most programming books, regardless of language, author or purpose, seem to be exactly the same. They have the same exercises, cover the same ground and describe things in exactly the same way. What can we tell from this? Natural language processing is more advanced than they are letting on and programmers aren’t really human at all.

Just kidding. But if you pick up a couple of basic books (I suggest the two above – they’re both available online for free perfectly legally) and then some more specialist knowledge books if you want to specialise, then that’ll be great.

The key with them is to actually do the exercises. Like copywriting, you can’t learn by reading about it and saying, “Yeah… I understand that.” You have to do the coding and find the bugs and learn to program unconsciously.

Once you’ve done that, you’ll understand the basics of your language.

(You might need to learn about using the command line if you’ve not experienced it before; the guy who wrote Learn Python the Hard Way also wrote a guide to using the terminal in OSX and Powershell in Windows. If that sounds gobbledegook, then just Google it. It’s really easy to get the hang of.)

Moving On: Standing On The Shoulders Of Giants

The greatest thing about learning to program – especially with popular programming languages like Python – is that practically everything has already been done. Most problems have been solved and with a little Google Kung Fu, you can find solutions to your problems.

Now, “stealing” someone’s code is a bit unethical, but it’s also stupid; if something goes wrong – and it will – you need to understand what breaks.

That said, you can find examples of most different applications for Python available online – and there are even tutorials for most things you’ll think of as a beginner – everything from creating social media bots to pulling huge amounts of data from various sources and combining it into documents.

If you take the ideas and lines of code and spin them around until you create something you want, then that’s a lot quicker than writing everything from scratch. Also, throw in the fact that there are sites like Stack Overflow where people are willing to answer questions, and you’re standing on the shoulders of giants when you learn programming.

A Quick Example

Here’s an example I’ve created: I was looking into moving to a new city. I wanted to find out which areas were safe to live in and which weren’t. Now, I could have asked some people and got unsatisfactory answers.

Instead, I used my pretty-mediocre programming skills. I found that all recorded crimes in the UK (or England at least) exist on a public database. Then I went and spent a couple of hours finding examples online of where people had pulled data from tables using Python. Then, I found a tutorial for plotting data on a map. All that was left was connecting the dots.

I created a tiny little application which took data from police databases for the city, sorted it and output it to a map of the area.

I got rid of things like domestic disputes and parking tickets because they were irrelevant to my search for an area, and tried to highlight things like thefts, assaults and muggings, because I considered those particularly relevant.

What I was left with at the end of running the program was a nice little map (or set of maps) that gave me an official list of bad places to live and good places to live (assuming you don’t like brawling in the street, being burgled or murdered, which I’m assuming covers most of you.)

This took less than two hours and is just a simple example of something you can achieve with minimal knowledge, a little patience and the ability to put together stuff you find on the internet and make it work.

Final Thoughts

I thought this would be an article where I ran out of steam. The opposite is true, in fact.

This article – and more importantly, the books I recommended above – will get you to a decent level of beginner’s understanding.

Now, I’m no expert. I’m not even a dedicated amateur. However I do know more than is in this article. If anyone’s interested, I can talk about how I use programming and various other subjects on the topic.

  • Kyle says:

    Wow, wasn’t expecting an article on Python from Jamie McSloy. I took some Python courses on Coursera and Udacity (I preferred the coursera courses) for a while. I dropped learning it, but would like to take it back up soon.

    I was going to get the Learn Python the Hard Way book, but it’s not free. Where did you find the perfectly legal free version?

    I downloaded the Think Python book for future learning and reference.

    Thanks for the resources Jamie.

  • Kyle says:

    Never mind Jamie, I found the link to the free version. Wish it was downloadable, but can never complain about free stuff. Underneath the green buy now button for anybody else who is looking for Learn Python the Hard Way.

  • Cattaboy says:

    This article came at a very interesting time…became interested with your discussion of automation and began looking into data analytics, etc…
    Took a course on Udemy…liked it but looking for ways to actually practice the info i learned…
    Curious to hear what youve come up with?

  • […] Yesterday, I wrote a post about Python Programming. I asked readers whether if it was an item of interest, and if so, I said I’d write some more about it. […]

  • […] can automate all of those things from your browser window. With a little knowledge of Python programming language, you can do anything MassPlanner or it’s now hundreds of clones can […]

  • >