This is a series of graded exercises that introduce pupils to sets, sorting and syntax – concepts that will underpin any future work they do on coding. It also gives pupils practice in working with ‘AND’, ‘NOT’, ‘OR’ and familiarises them with the idea of variables and naming sets.
Aim: To familiarise pupils with basic syntax that they will use when they eventually write code
You will need to make nine sticks and nine circles. (see picture on the left) There should be three large (long) sticks, three medium sticks and three small ones. Similarly there should be three large circles, three medium circles and three small ones. Paint one of each size red, one white and one black. You will also need some rings made out of rope (joined with gaffer tape or similar) or cardboard. The diameter of the rings should be larger than the longest stick.
Pupils will be able to:
- Explain that a set is a group of things where every item in the group has something in common
- Recognize a SET
- Recognize how something is being SORTED
- SORT a SET based on simple SYNTAX
- SORT a SET based on the AND, OR, NOT SYNTAX
- Spot the odd one out in a SET
In computing we SORT data into SETS using SYNTAX. All three are important. Sorting means that things go to the right places (In a library, all the books are in alphabetical order based on the authors’ surnames). Sets mean that similar things are together, so that things make sense (grouping e.g travel books, reference books, novels etc). And syntax is our way of making sure that the things are being sorted correctly.
For this exercise we are going to use the sticks, circles and rope rings to show how things are sorted into sets. The sticks and circles have three properties to help sorting and setting; size, colour and shape. The rings are used to represent the boundaries of SET – “All things inside this ring are BIG”. They are a very visual way of grouping objects together. The difficulty of this task varies from basic sets and sorting to more advanced ‘Venn diagrams’ and embedded sorting parameters.
The exercises in this page are split up into one of three categories: Tell me, Show me and Troubleshoot
‘Tell me’ exercises are when you set up the sets and ask the pupil to explain (depending on the level) what the set is or how the set was sorted and to think about a name for the set.
‘Show me’ exercises are when you give them the syntax and they must sort the objects into the sets
‘Troubleshooting’ is an extension of the tell me exercises where you set up the sets, but place 1 item in an incorrect place and have the pupils try and identify it.
Why SYNTAX is really, really important!
At this early stage we don’t expect the pupils to be able to use proper ‘coding’ syntax but we do want them to acquire logical concepts and familiarity with syntax patterns that they will meet all the time when they write code. More importantly, we should not accidentally teach them incorrect syntax!
A machine, computer or device will only ever do what EXACTLY it has been told to do. To the letter. Very much like small children! This means that improper syntax can lead to some unexpected results. For instance, imagine you had a child eating dinner and you say this:
“You can have a dessert if you eat ALL your carrots and peas”
The child then eats all the carrots and two peas. This satisfies what you have said to the letter, since they have eaten all the carrots and enough peas to make it a plural. So we need a statement more like this:
“You can have a dessert if you eat ALL your carrots AND ALL your peas.”
This means the child must eat all the carrots and all the peas so that they can have dessert. That is correct syntax if you want them to finish up both. (Unfortunately it is at this point that you inevitably forgotten to add broccoli to the syntax and need to start all over again.)
First check whether children understand what a set is. At this stage, it is enough for children to know that a set is a group of things where every separate thing or person in the group has something in common.
Explain that the people in the room are a set of people that are in Class 3. You could play some quick games such as make a set of boys and a set of girls. Or make a set of people with blue eyes and a set of people with brown eyes etc.
Using the sticks and circles – Beginner level
At a beginner level you can start with a Tell Me exercise. Start with just the sticks, sorting them into either size or colour. Ask the how these sticks have been sorted.
Try this a few times with different variations. After you are satisfied that they have that concept, add the circles into the sets.
After you are confident that they understand the how the sets work, begin the Show Me part of the exercise.
This time, ask the pupils to create their own sets based on a syntax you give, e.g. Can you make a set of all the red pieces?
Again, vary this around with size, colour and shape.
Next we will be complicating the syntax by using a ‘NOT’ statement. For instance:
“Can you show me all the pieces that are NOT small?”
Practice this again by varying the size, shape and colour.
The next two syntax keywords we will be using are ‘AND’ and ‘OR’. These words reduce and increase the scope of the syntax respectively. When used in the correct syntax the ‘AND’ statement specifies that an object must satisfy additional criteria in order to be accepted into a set:
“Can you show me all the pieces that are BOTH small AND red?”
(You will probably need to stress the ‘BOTH’ here to ensure that correct syntax is used. Otherwise you can end up with the peas and carrots situation described above!)
This can also be mixed with the NOT statement:
“Can you show me all the pieces that are BOTH circles AND NOT big?”
The OR statement is useful as it allows us to increase the scope of our sets without letting everything in:
“Can you show me all the pieces that are circles OR that are red?”
That completes all the commands that we want to use in these beginner exercises. With these commands it is possible to create sets that range from very general (with broad syntax such ALL red objects) to specific individual cases (i.e single objects which are Red AND are small AND are sticks). By mixing and matching the commands it is possible to exclude/include any number of variables.
The final thing we include at this level is troubleshooting or spotting the odd one out. One of the most important things about coding is understanding why something doesn’t work or why something is behaving wrongly. To that end, the next exercise is trying to get children to understand and explain why something does not belong in a group. Secondly by understanding why something is not part of a set, it forces the pupil to think about the syntax that governs the set.
First, place a set in a loop using any syntax statement, then add another object that is encompassed by the statement. For instance, place all medium objects in the set and then add a large object. Ask the pupils to spot the odd one out and explain why it is the odd one out.
The more able children can also explore ‘equivalent’ statements e.g A set of things that are not red and not black. Is there another way of saying this? Or, a set of things that are not small and not medium and not round etc.
One Comment on “FP/KS1 Understanding Sets, Sorting and Syntax (1)”