Data, ML

The data scientist learning plan for 2021

When you look online at what it takes to become a data scientist, it’s enough to make your brain melt. You have people telling you that you need to be an expert statistician / mathematician; you need to be a top-level coder in 15 different languages; be proficient with every type of SQL/NoSQL database on […]

Read more
Python

Calculating Distance Between Two Geo Points In Python

As you may be aware, I am a Python tutor online and quite often I get asked pretty specific questions. This week, I was asked to show a simple way to find the distance in kilometres between two geographic locations. So, here it is then – the easiest way to approach this problem is to […]

Read more
Python

A UK Postcode Validation Script In Python

The below script takes the input of a UK postcode and ensures that it matches a valid format. I have handled the below formats: X11XX XX11XX XX111XX To do this, I use some regular expressions. Let’s look at one: “^[a-zA-Z]{1}[0-9]{2}[a-zA-Z]{2}”. Here: The beginning of the string (denoted with a ^) needs to be a letter. […]

Read more
Python

Making a simple hangman game in Python

Today I thought it might be cool to make a super simple little text based game in Python in my spare 15 minutes. So I made this hangman game. As you can see, the word chosen is ‘squiggle’. As the user selects new letters, all occurences of those letters are uncovered in the list. If […]

Read more
Python

Python Brainteaser: Formatting Numbers with Commas

Often, you will want to format your numbers in Python because it’s quite hard for a user to read 10000000000 and immediately understand it as: 10,000,000,000. So, this little article will show you one possible way to do the formatting – using many of the Python concepts discussed in previous articles and in my Udemy […]

Read more
Python

Introducing Zip Lists in Python

The Python zip function is incredibly useful. It takes in an iterable (a list, a tuple, a dictionary etc..) and returns an iterator. Well, that’s as clear as mud, right? Let’s look at an example to clear things up. Let’s imagine I have three lists like below. These lists are related to one another. Index […]

Read more
Python

Quick Tip: Lambda Functions

Those of you that know me will know I am not a fan of Lambda functions. I just don’t buy into the notion of making code as concise as possible at the detriment of readability. To show you what I mean, I have written two functions. One is a Lambda function and the other is […]

Read more
Python

Maintaining state while threading in Python

If you have ever worked with threading in Python before, you may have encountered issues where everything gets a little bit out of step (if you’re incrementing a counter, 2 threads may simultaneously try to increment it & mess up your program). So we can deal with that using queues. Let’s walk through an example […]

Read more
Python

A crash course in threading and multiprocessing in python

When you first start looking into asynchronous processing in Python, you’ll come across a couple of terms: threading and multiprocessing. The first part of this article then, is about understanding what those two terms mean and when you should use one over the other. What is threading? Threading is a way to overcome performance issues […]

Read more
Python

Making a simple command line to do list in Python

I’ve been asked recently what some super simple tasks would be to support learning Python so I’ve decided to post a few of them. Yesterday, you may have seen my article, looking at how we might create a command line quiz, with a time limit. Today, I am going to look at how we might […]

Read more
Golang, Python

Building a quiz with a time limit in python and golang

In this article, I am going to go through how we might create a terminal based quiz application where we ingest a CSV with quiz questions and answers, accept an answer from a user (and confirm if it’s correct) while doing a countdown to make sure they don”t exceed a specified time limit. In the […]

Read more
Python

The basics of threading in Python

If you’re a frequent reader of my website, you’ll know that I’ve been doing a lot with Golang recently.. like, a lot and it got me thinking about how easy concurrency is in Golang and how it just isn’t the same in Python. Below, we have an example of a simple for loop being threaded […]

Read more