A robot can be programmed to solve a rubiks cube.
The robot follows the same steps every time it wants to solve the rubik's cube. The sequence of steps used to solve a problem is called an algorithm.
Let's look at a simple problem. A user inputs a number into a computer program. The program decides if the number is odd or even and produces an appropriate result.
The algorithm can be presented in a number of ways:
Enter a number and store it in computer memory
If the number is even, output "This is an even number"
If the number is odd, output "This is an odd number"
PRINT "Enter a number"
INPUT number
IF number%2 = 0
THEN
PRINT "This is an even number"
ELSE
PRINT "This is an odd number"
ENDIF
We can also represent an algorithm using flowcharts.
In this part of the course, we will design algorithms in different formats and also try to determine the purpose of given algorithms.
We will test our designs using suitable test data.
We will use our algorithms to write program code eg in Python. When we input data into our programs we will look at strategies to ensure that only valid data is accepted.