After reading lesson 13, you’ll be able to
- Understand how the Python interpreter makes decisions
- Understand which lines of code get executed when a decision is made
- Write code that automatically decides which lines to execute depending on user input
When you write a program, you write lines of code. Each line of code is called a statement. You’ve been writing linear code, which means that when you run your program, every line of code is executed in the order that you wrote it; none of the lines are executed more than once, and none of the lines are skipped. This is equivalent to going through life without being allowed to make any decisions; this would be a constraining way to experience the world. You react to different stimuli in the world to make decisions, which leads to much more interesting experiences.
Consider this
It’s Monday morning. Your first meeting is at 8:30 A.M., and your commute takes 45 minutes. Your alarm clock wakes you up promptly at 7:30 A.M. Use the following decision-maker to figure out whether you have time to eat breakfast.
![](https://drek4537l1klr.cloudfront.net/bell/Figures/108fig01.jpg)
A flowchart to decide whether you have time to eat breakfast after your alarm clock rings and you have a meeting that morning
Answer: You have time for breakfast!