All Basic Python theory articles in order. Variables, operators, conditionals, loops and functions explained from scratch with real examples and direct comparisons with other languages. If you’re starting with Python, start here.
-
Python functions — stop repeating code once and for all
Python functions are the tool that transforms messy code into organised, reusable code. Until now every program you wrote was a sequence of instructions that ran from top to bottom, once. Functions let you name a block of code and reuse it whenever you need it, without copying and pasting. This is one of the most important concepts in FP1…
-
Python loops — for and while without beating around the bush
Python loops for and while give your code the ability to repeat itself. Without loops you’d have to write the same instruction a hundred times to do something a hundred times. With loops, three lines. It’s one of the most important concepts in FP1 and also one of the most confusing at first — especially knowing when to use for…
-
Python conditionals — if, elif and else explained from scratch
Python conditionals if elif else are the first tool that gives your code intelligence. Until now your programs executed every line in order, top to bottom, making no decisions. With conditionals you can make Python execute certain instructions or others depending on whether a condition is met. It’s the leap from “program that calculates” to “program that decides”. What is…
-
Python operators — complete guide with the mistakes everyone makes
If you’re already comfortable with variables and data types, the next natural step is Python operators. They’re the tools that let you perform calculations, compare values and make decisions in your code. In this article we cover every type of Python operators you need in your first year, with the three mistakes I saw most often in class explained in…
-
Variables and data types in Python — why Python thinks differently
Variables and data types in Python were one of the first things that confused me when I started my Data Science and Engineering degree. In Python you just write x = 5 and you have a variable. No type declaration. No telling the computer what kind of value it is. Coming from zero programming experience, that felt like magic. In…
