Here at CodeMD, we believe that learning to code shouldn't be a slow, laborious process. We want to keep this tutorial as short as we can to ensure you get enough information to get your coding quickly. Please follow this like a road-map, a step-by-step guide on how to get set up in and you should be on the way in no-time.

What is code?

Simply put, you give code an input, it processes the input, and produces an output. Input --> Process (code) --> Output. At CodeMD, one of the languages we teach in is the programming language Python.

To write your code, you need a text editor. We're not talking about Microsoft Word, but special text editors designed specifically for coding. We're going to use Google Colaboratory to ensure everyone can get started quickly!

What is Google Colaboratory?

Colaboratory is a way of running code using a speedy Google server, at zero cost to the user. It allows us to all work from the same starting point, and avoids laborious software downloads that take up your valuable disk space. We'll be writing code here in the language Python. We've chosen this language for a number of reasons, to find out the rationale behind this and more about different programming languages in general, stay tuned for an article soon on that specific topic.

Can I code anything in Colaboratory?

Unfortunately no. Colaboratory is limited to Python at the moment - that being said, it's absolutely fantastic for Python. For mobile app development, and web development we may need to download some software, but we'll aim to keep this to a minimum, and let you know exactly how to download and install it!

Getting started...

The first step is to create a Google account. Already have one? Marvellous, just sign in on your browser and you're ready to go. We recommend using Google Chrome whilst running Colaboratory (it is made by Google afterall).

Once you're signed in just head to colab.research.google.com - this will become the hub for many of your coding adventures with CodeMD (you might even want to bookmark it).

If this is your first time visiting Colaboratory then your screen should look something like this...

Click the "Cancel" button to get rid of the orange pop-up window so you can have a good look at the welcome screen. Your screen should now look like this...

Don't be alarmed by any of the "TensorFlow" related code written on the page (we'll get to that later).

Opening up a blank notebook

This is very simple - just head to File --> New Python 3 Notebook and a new tab should open looking something like this...

In the top left corner you can see that it's labelled as Untitled0.ipynb, rename it by clicking on the label and just type something over it. Since you'll be logged into your Google account, the file will be saved to your Google Drive automatically for easy access on the go.

Runtime settings

We need to adjust a setting or two in Colaboratory to make sure everything is able to run smoothly, and then you'll be up and running.

Go to Runtime --> Change runtime type (as shown above) and the pop-up below should appear...

We'd like to you change the "Hardware accelerator" from None to GPU - this will vastly improve the speed at which Colaboratory can process the data that we're going to feed it.

For some tutorials you may also need to upload some files. On the left-hand panel, go to Files --> Upload and then select the file you would like to upload (it'll be clear from the tutorial what you will need to upload so more of that later!)

Let's write some code

It's time to write your first line of code - have a go at writing the line below.

print ("Hello world")

Then click the Play button to the left of the textbox. Your code should now run - congratulations you've just written your first line of code! Have a play around and see what else you can make your computer say...

You now have all the tools you need to get stuck in and write some data analysis scripts. In fact we're so confident that you have what it takes that our first tutorial involves machine learning algorithms. Head to Machine Learning with Chest X-Rays to get started on manipulating some real-world data with code that you will write yourself.

Are you ready?


Written by Kamila Karimjee , PhD student at the Royal Veterinary College