Conditional structures in Python: the if-else statement

Опубликовано: 20 Май 2026
на канале: PatchyPython
96
0

Try this code in your browser: click here
https://tinyurl.com/6hkfpbd6

The if - else statement allows your program to "branch", that is to execute different instructions according to whether a certain condition is True or False. In this video I review the three main flow control structures of imperative languages such as Python - namely sequential execution, branching and loops. I then introduce the if-else statement with a practical example related to Boyle's law (the one that goes "a watched kettle never Boyles" ;) For more information and to try out the code, click on the link above - a notebook will open in your browser, no need to install Python on your machine.

Embedded video, also part of the following courses:
Computer Programming at Queen Mary, University of London
FREE Colab notebook: https://tinyurl.com/4umjbjvp
Coding for Scientists at Queen Mary, University of London
FREE Colab notebook: https://tinyurl.com/539p4b5f