November 11, 2022

Let us look at your last post on social media. No, not your own post, but your comment on your favourite influencer’s post. How are the comments aligned? For better understanding, the original post starts at the beginning of the line. The first comment starts a few spaces away from the original post. If you…

November 10, 2022

In life, we compare things. In writing, we use symbols like <, >, and = to tell that one thing is greater, less than, or equal to another. Python uses the usual logical comparison symbols we use in mathematics, with some bit changes:     Equals: x == y This means x and y are equal…

November 9, 2022

My friend and I graduated college the same year and went job hunting. He was always talking about how huge his skills are and how high in demand they are in the labour market. He rants that if he would ever sit for any job, they must be ready to pay him $5,000 monthly. I…

November 8, 2022

Here is another common conditional in Python. We use this one when the condition of a program is needed or can be either True or False. Hence, you will specify what the computer will do when True and also when False. That is why there is an if and an else. That is telling the…

November 7, 2022

First, understand what the elif means. It is Python’s way of saying, “If you cannot buy Huawei or LG, try Tecno. It is a way of giving another outlet. If you write an if…elif…else statement, the computer will run the if condition first. If that one is False, it will move down to the elif…

November 6, 2022

When you are writing code, you are necessarily putting down your thoughts for the computer to read and execute. Nonetheless, there are instances where you may need to explain your opinions to yourself and others who may read your scripts. Commenting on codes will help you when you want to improve your script later after…

November 5, 2022

You are an excellent programmer now, and you can declare a variable. Good for you! You can create a variable and assign a single value to it like the age variable: and the girlfriend variable: But what if you want to compute the ages of all your friends, or a list of all your girlfriends…don’t…

November 4, 2022

Index in Python means the position of a specified item in a list or a string. This is done with the method called index (). This method shows the position of the item you put in the bracket from a range in a list or string. Index in a list can go two ways or…

November 3, 2022

Slicing in Python means cutting out a part of a list you wish to use in another part of a program. Based on indices of the items in a list, we can slice lists. For example, by taking the list we created and calling my_list, we can slice it. Look at the following codes closely:…

November 2, 2022

You have learned how to change the flow of your code with conditionals like if, else and elif. There is another way of controlling the flow of a program. We call it a loop. There are two loops in Python, for loops and while loops. Imagine that your dog is sick and the doctor wants…

Python Tutorials