I recently had a coding challenge where I theorised that a concise solution could be found if functions could be treated as elements and packaged into lists / arrays or even dictionaries. Perhaps I came across an article discussing this feature — hence the intuition — but I never really had the chance to try it out before then.

Turns out that in both Python and JavaScript, functions could indeed be treated as elements and behave appropriately when we pass valid argument(s) to them.

Imagine we wanted to create a simple list of functions that returns the area or volume…

It is the last day of the year and I thought that perhaps I should share one last post on a coding challenge before we welcome a hopefully better 2021!

I found an interesting validation problem on Edabit that could help revise some concepts on Python list manipulations. Suppose you have been tasked to write a program to determine the winner of each tic tac toe game — ‘X’ for Player 1 and ‘O’ for Player 2, how could we do it?

Please do not read further if you want to attempt to solve the problem without spoilers first.

If…

The game is available here.

I find this snake game project mildly ironic, as I have built this game without using any code from its namesake and all-time favourite language of mine — Python — which would have been quite punny.

Nevertheless, as they say — horses for courses — a web application without the need for any backend would not require the use of Python. As this game resides completely at the client side, JavaScript would have been the perfect choice.

Most importantly, the HTML and JS code have been largely built from the original codebase from Straker’s Github…

The Fibonacci sequence was one of the first mathematical concepts that I analysed when I started coding. In particular, this sequence was vital in enabling me to grasp recursion.

To construct a positive Fibonacci sequence, we start by initialising the first two terms: 0, 1.

The next term is derived from the sum of the prior two terms: 0 + 1 = 2. And so on.

In Python, we can automate the process via recursion. So if we want to determine the *third* fibonacci number: in the function **fibonacci**, we first check if the sequence already has the value…

Python with its highly readable syntax is perfect for solving analytical problems, especially if they are unlikely to become more complicated with scale.

One of the recent problems that I completed recently was a coding challenge that required me to write a short program to evaluate if a mathematical formula or has valid brackets. So, if we strip out all the variables and operator to leave just the brackets, they should balance properly without any unclosed bracket encased in another bracket. For instance, *{[()]}* and *[(){}<>]* would be considered valid but *[(])* would not.

In today’s world, we take for granted the numerical system that we use on a daily basis. The average human being is born with ten fingers, hence a counting system on base 10 is very natural to us.

We have exactly 10 elementary numerical symbols, ranging from 0 to 9. Every other natural number can be expressed in a permutation of these 10 symbols. I was teaching my eldest daughter addition with change, and she was able to keep up with the lesson. …

As a hobbyist, I have tried to complete at least one coding challenge a day to maintain the positive pace of learning.

Languages have now extended to Python, JavaScript, PHP, C++, C, Java, Swift, Kotlin, in order of comfort. In terms of nimbleness, I tend to think quite exclusively in Python for analytical problems, although I do use JS quite a bit when I have to, especially when I am tinkering on something in Chrome, or doing some web development.

As my coding endeavours have largely been bite-sized, I almost never had to resort to building more sophisticated architectures involving…

In recent weeks, I have been looking into the intersection between the languages. On the one hand, we have English as widely understood by human beings in this world. On the other, we have a host of programming languages with English-like syntax, designed to be understood by some human beings, before being compiled down to bytes for machines to understand.

The context of my study was triggered by my desire to extract insight from text — a form of unstructured data critically understood by the average human but had been notoriously difficult for machines to parse and analyse in a…

Sometimes when I am used to a particular convenience or tool when working with one technology, I tend to want to default to using the same feature with another. However, core developers across technologies do not always agree on what are the most fundamental functions that should be built-in.

Take Python and JavaScript for instance. The humble **sum **function allows one to quickly compute the sum of individual elements in a list / array. MS Excel users would also be familiar with this.

When I started out on my journey as a coder, I was obsessed with finding out which is THE language to learn and master. My work and personal interests revolved around data and the analysis of data — and still do till today — hence I naturally selected Python, the mainstay of data manipulation, machine learning and artificial intelligence. Think numpy, pandas, matplotlib, scikit-learn, tensorflow, just to name a few.

Python’s beauty is in its readability. It is as readable as pseudocode, so why bother writing code that only some humans can understand when we could express our thoughts in…