Tag: Python


  • Learning to Repeat Myself (the Smart Way)

    When you want to repeat some tasks multiple times, or apply the same task to a group of data, it’s tempting to just write the same statement again and again. For example, suppose we have a list that contains the days of the week: If you want to print out each day, the most straightforward…

  • The First Fork in the Road: Flow Control

    Flow control decides the order in which statements run.So far, every program we’ve written just goes straight from the first line to the last — no questions asked. But what if we want our program to make decisions?Like: Flow control is what makes this possible. It’s how we tell a program to choose different paths,…

  • True or False? Your Code Has Opinions Now

    Boolean Expressions: Teaching Code to Make Decisions We introduced the Boolean data type in a previous post. It seems very simple — the value can be either True or False. Is it really that simple? Let’s see for ourselves. These two variables each hold a Boolean value: ⚠️ Note that the capitalization is important! True…

  • Python Lists: Your First Collection Adventure

    In the previous post, we talked about basic data types along with their methods and operators. Now, let’s move on to one of the most commonly used collection data types: the list. A list is a collection where you can store related elements (or even completely unrelated ones 😁). Order matters in a list, and…

  • Doing Stuff With Variables: Basic Operators & Methods

    We now know about different variable types. The next step is: what can we do with them?In this post, we’ll look at two types you’ll see the most: Number and String. One thing before we start — operations in Python don’t modify the existing values for numbers or strings. They are immutable, so operations create…

  • Data Types and Variables

    Let’s talk about data types and variables. In Python, the concept of primitive and reference types is a bit blurry, because everything in Python is an object. A variable is treated more like a label pointing to a value, rather than a container that holds the value itself. In Python, those “primitive-like” types are actually…

  • The very first step to Python

    Setting Up Your Python Environment Before we jump into writing Python code, we need to make sure your environment is ready. Don’t worry — this part is quick. Step 1: Check if Python Is Installed Open your terminal (or Command Prompt on Windows) and type: or If Python is installed, you’ll see something similar to…