Example 1
🧮 Add two numbers
Teaches: Sequence: input, a calculation, output
- Start
- ↓ Input the first number (a)
- ↓ Input the second number (b)
- ↓ sum = a + b
- ↓ Display the sum
- ↓ End
The simplest kind of program runs straight down: each step once, in order. This is called a sequence.
It teaches the three parts nearly every program has: take input, work something out, show output. Notice that sum has to be worked out before it can be shown: the order of the steps matters.
The same flowchart in Python
a = float(input("What is the first number? "))b = float(input("What is the second number? "))sum = a + bprint("The sum is " + str(sum))