0% found this document useful (0 votes)
8 views

Flowcharts

Flowcharts

Uploaded by

molaposk10
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Flowcharts

Flowcharts

Uploaded by

molaposk10
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 10

Y10-01-CT5: Flowcharts

Y10-01-CT5: Flowcharts

Learning objectives
In this lesson you will learn to:

•translate code into flowchart symbols


•represent an algorithm in a flowchart
•translate a flowchart into code.

For more information on this topic, and additional student activities,


refer to student book Topic 1.2.

© Pearson Education Ltd 2020. Copying permitted for purchasing institution only.
Y10-01-CT5: Flowcharts

Algorithms

In previous lessons we discussed what an algorithm is.

An algorithm is a set of instructions to complete a specific


task.

So far, we’ve been looking at algorithms as written instructions, or in


program code.
There are others ways to represent an algorithm. One of these is
using a flowchart.

© Pearson Education Ltd 2020. Copying permitted for purchasing institution only.
Y10-01-CT5: Flowcharts

Flowcharts

A flowchart is a graphical representation of an algorithm.

Each step in the algorithm is represented by a symbol.


Symbols are linked together with arrows showing the order in which
steps are executed.

© Pearson Education Ltd 2020. Copying permitted for purchasing institution only.
Y10-01-CT5: Flowcharts

Symbols
These are the symbols that you will need to be able to use in your
flowcharts.
These are not the only symbols you will use, but we’ll introduce the
rest later.

input
start process
output

This is the This is the process This is the data The arrow is
terminator symbol. It is for any symbol. It is used to join
symbol. It action that needs to used any time symbols
goes at the be carried out such you need to together. The
beginning and as a calculation or take an input arrow shows
the end of a variable or output a the flow of
flowchart. declaration. value. the algorithm.

© Pearson Education Ltd 2020. Copying permitted for purchasing institution only.
Y10-01-CT5: Flowcharts

An example
start

Let’s use a program we are familiar with to height =


look at how a flowchart works. user input

width =
height = int(input("Enter height: ")) user input
width = int(input("Enter width : "))
area = height * width
print("The area is", area) area = height *
width

output
area

end
© Pearson Education Ltd 2020. Copying permitted for purchasing institution only.
Y10-01-CT5: Flowcharts

Using a flowchart
You are not usually going to turn Python code into a flowchart.
Most often you will do the opposite – turn a flowchart into Python code.

You will be asked to construct a flowchart to solve a problem.

This is the same process as writing an algorithm to solve a problem,


except you will use symbols to show the flow of the algorithm instead of
writing it out.

© Pearson Education Ltd 2020. Copying permitted for purchasing institution only.
Y10-01-CT5: Flowcharts

Worked example
Here is the written description of an algorithm.

• set PI to 3.141
• ask the user to enter the radius of a circle
• calculate the area of the circle (PI * r * r)
• output the area with a suitable message.

Express this algorithm as a flowchart.

© Pearson Education Ltd 2020. Copying permitted for purchasing institution only.
Y10-01-CT5: Flowcharts

Runtime errors
This is a process (declaring a constant, start
Set PI to 3.141
whose value should not change)
set PI to
3.141
Ask the user to enter the
This is an input
radius of a circle radius =
user input

Calculate the area of the This is a process area = PI *


circle (PI * r * r) (a calculation) radius*radius

output
area
Output the area with a This is an output
suitable message. end

© Pearson Education Ltd 2020. Copying permitted for purchasing institution only.
Y10-01-CT5: Flowcharts

Wrap up: you have learned how to…


 Translate code into flowchart symbols.
• Calculations are processes (rectangles), input and output are
data (parallelograms).

 Represent an algorithm in a flowchart.


• Start and stop must always be there.

 Use arrows to show the flow of the program.

 Translate a flowchart into code.

© Pearson Education Ltd 2020. Copying permitted for purchasing institution only.

You might also like