harritech.files.wordpress.com file · web viewor write the same algorithm, in pseudo-code. then we...

28
What is an Algorithm?

Upload: phungnhi

Post on 27-Apr-2019

217 views

Category:

Documents


0 download

TRANSCRIPT

What is an Algorithm?

A precise set of

instructions to solve a problem

We can draw an algorithm,

called a flowchart

Or write the same

algorithm, in pseudo-code

Then we cancode it in a

program using Python

Start

Output "where do you live?"

Input town

town = "Altrincha

m"?

Yes N

o

Output "walk

to school

Output "get the

bus!"

Stop

RECEIVE town FROM

IF town = "Altrincham" THEN

SEND "get the bus" TO DISPLAY

SEND "walk to

school" TO DISPLAY

ELSE

END IF

town = input ("where do you live?")

if town =="Altrincham":

print ("walk to school")

else:print ("get the bus")

Program codetyped in uses Python

Pseudocodewritten uses keywords

Flowchartvisual uses shapes