Functions in Python

Functions allow us to write several lines of code, that may need to be called at different times in our code, and to call all of the code, with using just the function name, and some parameters. Sometimes functions are used to make code more readable, calling a function by a logical name, rather than…

Using the If Statement

We’ve looked at decision statements in flowcharts and pseudo-code before. Now we want to look at how to build them in Python. Decisions are very important because they allow you to skip over a section of code that isn’t relevant to you. In its most basic format, an if statement in Python follows the following…

Common Coding Problems

Over my 25-30+ years of coding (including hobby stuff as a teenager), I’ve made my fair share of coding mistakes. In fact, everyone who has ever written code before has written lots of errors. That’s why we test so much. Even today, I still make mistakes, many of them the same as you. The difference…

Math in Python

We want to look at performing some simple math in Python. To do so, we’ll first look at our last example from our introduction to Python examples. We took in a number, but in reality, we took in a string that had numbers in it. If we want to treat the value as a number,…