# Computational Thinking

Grey overlay

Pink

Green

Blue

Cream

Liliac

Purple

Yellow

## 1 Objectives

### Developing **Algorithms** learning strand, specifically:

- be able to understand and articulate a given problem
- be able to develop algorithms for given problems
- understand that algorithms are implemented on digital devices as programs.
- design simple algorithms using loops (repetition), and selection (if statement)

## 2 Computational Thinking

### Learn It

- Lets recap:
**Computational thinking**is the thought processes of understanding a problem and presenting its solution(s) in such a way that a computer or human can understand and a computer can effectively carry out.

- Lets break down the concept above:
- understanding the problem
- presenting the solutions so a computer or human can understand
- a computer can carry out solving the problem based on the solutions presented to it

### Try It

- Lets consider the following sequence of numbers. The problem to be solved is to find the largest number:

10 12 8 9 6 15 20 14

`Step 1`

: understanding the problem. This is very important step. We need to know what exactly the problem is. In this case,

- to find the largest number from the given sequence

`Step 2`

: presenting the solution so a computer or human can understand.

- What does it mean by
**presenting the problem**?- This means describing the problem in some fashion. For a human to understand, we can use text or diagram.
- The following is a solution to the finding the largest number problem described in plain but structured English:
1 Start from the first number in the list 2 3 if the first number is larger or equal to the next number 4 make the first number the largest number 5 else 6 make the next number the largest number 7 Move to the next number 8 Repeat the steps 3 to 7 until all the number in the list is compared

**But** - How to present the solution so a computer can understand? This is where computer programming languages come to play.
- Humans use programming languages to present/describe the solution to a computer. This is called
`implementation of the solution`

in programming language.- The following is the implemented solution using Python.

`Step 3`

: Computers follow the instructions from the solution presented to carry out solving the problem. Run the program below and see if the solution works.

## 3 Algorithmic Thinking in Computational Thinking

### Learn It

- In the previous finding the largest number problem, we have learned 3 equally important aspects of problem solving in computing:
- understanding the problem
- describeing/presenting the solution so a human or a computer can understand
- implementing the problem using programming language

- Lets focus on the step 2: describe/present the solution so a computer/human can understand. We did this by using a sequence of text or plain English but with some structure to make the solution easier for a human to follow.
- A solution given in step by step instructions is called an
**algorithm**. **Algorithmic thinking**is to have a solution to a problem, and the solution is such that it can be described in a sequence of instructions.- If we have an algorithm, then we can write a program to do it.
- Computer programs are just algorithms written out in a programming language so computers can understand.

### Try It

- Now, lets apply
**computational thinking**to a simple problem and try to work out step by step.Given a sequence of numbers: 45 67 -9 12 -92 -10 44 Find all positive numbers in the given sequence

- Try to work out the following by yourself:
- understanding the problem.
- using
**algorithmic thinking**, and plain but structured English to present a solution to the given problem so your peers can understand. - try to implement the solution you created in step 2 in Python. To implement it, you need:
- create a list to hold the numbers
- use a loop (for or while loop) to go through the list
- use if statement to decide if a number is positive or not

- run the Python program to see if it works.

### Badge It - Silver

#### learning strand: **Algorithms**

- Upload your written understanding of the above given problem in plain English to www.bournetolearn.com. Your work must include your understanding of positive numbers.

### Badge It - Gold

#### learning strand: **Algorithms**

- Your solution (algorithm) to the problem above in structured English. Upload your work to www.bournetolearn.com.
- Your algorithm should meet the criteria that it can be understood by a human or for a human to follow to find all positive numbers in a list.

### Badge It - Platinum

#### learning strand: **Algorithms**

- Screenshot of your implemented working solution in Python and upload to www.bournetolearn.com