-
When Code Starts to Look Like the Real World Object-Oriented Programming, or OOP, is a way of writing code that models how things work in the real world. In real life, we think in objects: Each of these things: OOP brings this way of thinking directly into code. Objects = Data + Behavior An object…
-
We know what a variable is. It is a label that points to a value. With variables, you can reuse that value again and again without needing to type it repeatedly. This is especially useful when a variable points to a calculated value. You calculate or process it once, and then reuse it throughout the…
-
Dictionaries With lists, we stored things in order and accessed them by position. That works… until your brain starts asking,“What was at index 5 again?” Dictionaries solve this by letting you use names instead of numbers, which feels a lot more human. Consider your friend and their favorite fruit — we can translate this relationship…
-
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…
-
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,…
-
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…
-
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…
-
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…
-
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…








