# 4. Loops and Statements

These notes are provided to demonstrate how to get started coding loops and conditional statements in Python. The general name for this topic is *control flow*.&#x20;

In the earliest days of computing, one of the first things we realized, is that we would need to execute different branches of code depending on Boolean conditions.&#x20;

If it is raining, switch on the windscreen wipers!&#x20;

We might use the console or Notepad++ to write a quick script, but for deliberate work, we are always going to use a proper editor. For writing commercial code, I use PyCharm. However, for these sessions, we are going to move to Visual Studio Code.&#x20;

During this walkthrough, I am going to introduce important concepts in Python; colons and indentation. Look out for this, and make sure you fully understand it. You really cannot proceed without this basic knowledge.

Before you begin. create a directory to keep example files in and you are ready to code.&#x20;

This could be on your OneDrive, in these examples, I am using **OneDrive\Python\Exercises\_04**&#x20;

To control the flow of execution in a program, we normally have a condition associated with a block of code. There are three main types of conditional statements we will deal with.

* If, Elif and Else
* Loops
* While
