The school trip list
Your class plans a trip. Ms Okafor has a messy list: names in any order, some prices, some students who have not paid.
She needs three things. A tidy list. The total cost. How many students have paid.
She does not collect new data. She changes the data she has. That is transforming data.
Key words
| Word | What it means | Example |
|---|---|---|
| Transform | To change data so it is more useful. | Sort a list by price |
| Manipulate | To change the shape or order of data. | Keep only students who paid |
| Analyse | To look at data to find out what it says. | Find the average price |
| Process | To take input, do a set of steps and give output. | Turn a list of prices into one total |
| Average | The total divided by how many items there are. | 60 divided by 3 is 20 |
| Percentage | A number out of every 100. | 75 out of every 100 |
| Filter | To keep only the rows that fit a rule. | Prices under £15 |
| Sort | To put items in an order. | Smallest price first |
The cells students fill in are left blank in this preview.
Three ways to transform data
Try it: manipulate a list
prices = [12.5, 5.0, 20.0, 8.0, 15.0]
print("Original:", prices)
prices.sort()
print("Sorted:", prices)
cheap = []
for price in prices:
if price < 15:
cheap.append(price)
print("Under 15:", cheap)
# Change 15 to 10 and run it again.
Make a free account to save your work and track your progress.
Manipulating: change the shape
Manipulating data means changing how it looks or where it sits. You do not find out anything new.
You can sort a list. You can filter it to keep only some rows. You can join two lists into one, or change "5" typed as text into the number 5. The facts stay the same.
Analysing: find out what it says
Analysing means looking at data to learn something new. You count, add up, and compare.
The total of the prices is one answer. The average is another. The percentage of students who paid is a third. Analysis turns many numbers into a few useful ones.
Worked example: total and average
| Step | What you do | Result |
|---|---|---|
| 1 | Write the prices | 10, 20, 30 |
| 2 | Add them up | 10 + 20 + 30 = 60 |
| 3 | Count them | 3 prices |
| 4 | Divide the total by the count | 60 divided by 3 = 20 |
| Answer | The average price | £20 |
The cells students fill in are left blank in this preview.
Quick check: which way?
Have a go
Quick check: which way?
3 questionsWorked example: a percentage
| Step | What you do | Result |
|---|---|---|
| 1 | Count the students who paid | 15 |
| 2 | Count all the students | 20 |
| 3 | Divide paid by all | 15 divided by 20 = 0.75 |
| 4 | Multiply by 100 | 0.75 times 100 = 75 |
| Another way | 20 goes into 100 five times, so multiply both numbers by 5 | 15 times 5 = 75 and 20 times 5 = 100 |
| Answer | A percentage is out of every 100 | 75 out of every 100 have paid |
The cells students fill in are left blank in this preview.
Processing: from input to output
Processing is a set of steps that takes input and gives output.
Input: a list of 30 prices. Steps: add them up, divide by 30. Output: one average. A program does this fast, and it can do the same steps for a million prices.
Match the job to the way
Have a go
Loading…
Your answers are marked here and are not kept. A college account keeps every student’s marks.
Your turn: the trip sums
Help Ms Okafor with the trip. Fill in four functions. One adds up the prices. One finds the average. One finds the percentage of students who paid. One keeps the prices below a limit and puts them in order. Press Run Tests to check.
def total_cost(costs):
# costs is a list of prices in pounds. Give back the total.
return None
def average_cost(costs):
# Give back the total divided by how many prices there are.
return None
def percent_paid(paid, students):
# How many out of every 100 students have paid?
# Divide paid by students, then multiply by 100.
return None
def cheap_sorted(costs, limit):
# Keep only the prices below the limit, smallest first.
return None
Make a free account to save your work, or press Start lab to work through the whole lesson.
Draw the process
The diagram shows how a program processes the trip money. Edit it in two steps.
- Add a box between the "Add them up" box and the output box. Write: divide by how many prices there are. Change the output box to say: the average price.
- Add one more input box of your own, such as the coach price.
flowchart LR
input[Input: the trip prices] --> add[Add them up]
add --> output([Output: the total])
Make a free account to save your work, or press Start lab to work through the whole lesson.
Key words crossword
Have a go
Loading…
Your answers are marked here and are not kept. A college account keeps every student’s marks.
Watch: the trip list, changed three ways
Press Play on the short film below. It follows Ms Okafor's trip list through the three ways to change data. Listen for the myth about sorting.
Film: Changing data
Changing data: manipulate, analyse, process
Every scene, as text
- The school trip list. Ms Okafor has a messy list (messy: names in any order, some not paid). A tidy list. The total cost. How many students have paid. She changes the data she has (that is: transforming data).
- Three ways to transform data. Messy list. Manipulate: sort and filter. Analyse: total, average, percentage. Process: steps from input to output. A useful answer.
- Manipulating: change the shape. [12.5, 5.0, 20.0, 8.0, 15.0] (list: the prices as they start). [5.0, 8.0, 12.5, 15.0, 20.0] (sort: smallest price first). [5.0, 8.0, 12.5] (filter: keep only prices under 15). The facts stay the same.
- Myth (false): sorting is analysing. [12.5, 5.0, 20.0, 8.0, 15.0]. [5.0, 8.0, 12.5, 15.0, 20.0] (sort: the same five prices, a new order). That is not true: sorting changes the order. You do not find out anything new. Analysing finds out something new (example: the average price, £20).
- Analysing: find out what it says. 10 + 20 + 30 = 60 (total: every price added). 60 ÷ 3 = 20 (average: the total divided by the count). 15 ÷ 20 = 0.75 (divide: paid by all students (15 of 20)). 0.75 × 100 = 75 (percentage: a number out of every 100).
- Processing: from input to output. Input: every order. Step: add the tax. Output: print the bill. A program runs the same steps on many records (example: all 500 students at night).
Final check
Have a go
Final check
6 questionsRemember
Tip
Manipulate: change the order or shape. Analyse: find out something new. Process: input, steps, output. Real work uses all three.