Day 4: Learning about sequential execution

Amy Sidra
2 min readJul 2, 2024

--

Photo by Patrick Ward on Unsplash

Essentially, the syntax of all programming languages consists of:

  1. Sequential: Ordered steps
  2. Branching: Skipping steps if a condition is met
  3. Looping: Repeating steps until or while a condition is met

On this fourth day, we will learn about :

Sequential execution.

In Python, the code that gets executed first is the one at the top, followed by the lines below it, and so on. This is called sequential execution. Let’s give an example. For instance, John is asked by his mother to buy sugar at the market. We’ll write the code for this in Python. We’ll use the “main.py” file from the lesson on the third day.

print('Mother said: John, buy some sugar at the market')
print('John goes to the market')
print('At the market, John buys sugar')
print('John returns home')
print('John gives the sugar to his mother')

Press the run button and see the results.

Let’s look at the results in the terminal. We will see that the code is executed in the order we wrote it.

Anyone Can Master Python in Just 7 Days

--

--