Let code do the boring stuff, it's better at it than you.

Learning to code could be one of the best professional decisions you make. We're not talking about embarking on a major career change into the world of programming rather how code can help you be better at the job you already do.

This is particularly the case when there is data involved that needs to be understood, analysed or crunched in any other way. Often we find ourselves having data and we know what we want to do with it, but we don't know how. More often than not, trying to do this manually would take an impossibly long amount of time, especially as the volume of data available tends to increase as years go by.

Of course the type of data you may have and the things you want to do with it can be very different depending on what job you do, and indeed even within the same field this can change significantly from one task to the next.

In this post we are going to demonstrate how programming can help you achieve a certain task by using a very general example. However the versatility of programming means that the same ideas can be applied to deal with any type of data in any way you want. Almost.

Here is a very simply task for you. Read the following short text and then write down all the words that have been used, and how often they have been used.

Hello. I hope that you are having a good week and that you are enjoying reading about coding. You may be wondering why I have asked you to perform this rather boring task. You will find out very soon

So the answers would look like this:

hello: 1

I: 2

hope: 1

Done? I know you cheated and stopped before completing the task. That's OK. It's a boring and unchallenging task, after all.

I would now like you to think about the following question:

What is the method you used to perform this task? Can you describe it briefly?

Can you now repeat the exercise above with this text instead?

There are 121,591 words, which is the entire text of Jane Austen's Pride and Prejudice. Of course you are not going to even consider counting how often each word appears. But if you had to imagine doing so, would you use the same technique as when reading the few lines of text above, or would you use a different method?

This is actually not a difficult program to write and a very short one too (about 20 lines of code). And more importantly, it takes a computer a fraction of a second to work out all the words in Pride and Prejudice and how often each one appears.

In case you're wondering, here are the top ten words in the Pride and Prejudice, with the number of times each one appears:

the 4323

to 4127

of 3601

and 3531

her 2215

i 2051

a 1939

in 1862

was 1842

she 1703

Whilst the task may be relatively simple in coding terms it perfectly illustrates the power of code to analyse large volumes of data extremely quickly. All that time saved can be better spent on analysing the results and gleaning insights from what the data is telling you. Ultimately it's a search for the truth and the data doesn't lie, the ability to code empowers you to be able to unlock this.

The value is immeasurable and it's code that's made this possible. Just imagine your current job with these skills in your pocket? Better analysis capabilities, better decision making and more confidence in your choices.

Codetoday offer a variety of introductory coding courses using Python. For more information click register below.