Author Archives: abraham

Help! My Else Clause Does Not Execute!

Sometimes people write code with if/else statements, but the else statements never execute, regardless of what they type in to be checked in their conditions. Let us consider two examples of such cases. I will use Python to illustrate the points. Scenario 1: if a or b user_answer = input(“Do you want to continue? y/n:… Read More »

Getting Started With APIs – Bonus Tasks

The Story So Far In our first article in this series, we looked at what APIs are and what they are used for. In the second article, we wrote a simple Python program that fetches some data from an API. In this article, we will introduce a loop, so that we can get historical data… Read More »

Where To Learn Python Programming

I am in a number of Python (programming language) groups on Facebook. One very common question in those groups is “Where can I learn Python?” I assume that people also ask this question outside Facebook, so here is a list of free resources to learn Python (and other technologies) for beginners. The list is not… Read More »

I Have Learnt The Basics. What Next?

One somewhat common question from beginner programmers goes something like: “I have learnt the basics of [programming language]. What should I do next?” To be honest, I find this question rather surprising. I would imagine that while learning a programming language, you get exposed to the uses of that language and the problems it can… Read More »

Solved. Laravel Error ‘Attempt to read property “nationality” on int’

I was getting an error in Laravel when trying to access a value from a related table, after defining relationships in the relevant models. Attempt to read property “nationality” on int I had defined the relationship in my model as follows: public function nationality(){ return $this->belongsTo(Country::class, ‘nationality’, ‘countryid’); } After trying many things to fix… Read More »