Flowcharts and Pseudocode
This is a free course. Log in to run the code exercises and track your progress.
Flowcharts and Pseudocode
A flowchart is a picture of an algorithm. Each kind of step has its own symbol, and arrows show the order in which the steps are carried out.
- Oval (terminal): Start and Stop.
- Parallelogram: input or output, such as "Read L, B" or "Print AREA".
- Rectangle (process): a calculation, such as "AREA = L × B".
- Diamond (decision): a question with a Yes and a No branch, such as "Is N > 0?".
- Arrows (flow lines): the direction of flow.
Pseudocode describes the same steps in short, code-like English that is not tied to any language. It is easier to write than a flowchart and easier to turn into code.
INPUT length, breadth
COMPUTE area = length * breadth
COMPUTE perimeter = 2 * (length + breadth)
PRINT area, perimeter
A flowchart for this problem is a straight line: Start → Read length, breadth → compute area and perimeter → Print → Stop. Flowcharts with a diamond, where the flow branches, come in the lesson on if statements.
Turn the pseudocode of this lesson into Python. Read the length and breadth of a rectangle from one line and print Area = ... and Perimeter = ... on two lines.
length, breadth = map(int, input().split())
# COMPUTE area and perimeter
area = 0
perimeter = 0
print("Area =", area)
print("Perimeter =", perimeter)Log in to edit and run this code.