Upper KS3 - Session 11
Switching from Blockly to Python
Objectives
Develop an initial understanding of Python as a text–based language
Understand that Python has precise syntax
Identify characteristics of Python, compare this with Blockly
Use and understand the movement instructions in Python
Use and understand while loops in Python
Resources | Vocabulary |
---|---|
• Interactive Whiteboard (IWB) • Levels 80 to 84 in Rapid Router • Resource sheets UKS3-S11-1 and UKS3-S11-2 • UKS3 Program Solutions Table • Video: 'Python' | • Python • Text-based programming language • Syntax • Indentation • Loop and iteration |
Let's get started
Explain to the class that today they are going to learn about a new programming language called Python.
This will be different from Blockly and you will be asking the class to spot the differences.
Show Level 80 on the IWB. [fig S11.1]
This is a simple challenge. Can we solve it in Blockly?
Choose a pair to do this solution on the IWB.
The class should find that easy and they can now see in the pane below how the Blockly code translates to Python. Draw their attention to the code in Python on the screen. [fig S11.2]
Hand out Resource Sheet UKS3–S11–1 between pairs. Ask them to take five minutes to discuss with their partner and write notes on what similarities and differences they see in the two different languages. [fig S11.3]
Recap on concepts of movement and repeat, comparing Blockly with Python. Encourage the students to identify characteristics of Python — text, syntax, indents…
Syntax is the grammatical rules of a language. Spoken English has syntax rules, e.g. it would be incorrect to say “I jumps”.
Experiment to see what happens if you change some of the code in Python.
Paired activity
Ask the students to try Levels 81 and 82, starting off by creating the code in Blockly, and watch it being converted to Python.
Ask them to make a note of the Python commands on their whiteboards.
Mini review
Bring everyone together to discuss what they have learnt.
Recap on the syntax of the my_van.move_forwards() instruction and notice how the my_van., the _ and the () are in the same position for each movement instruction.
The Blockly–Python phrasebook explains this in detail.
Ensure the students understand the terms: ‘underscore’ and ‘brackets’.
Show Level 83 on the IWB. [fig S11.4]
Let's look at this simple route again. What can we use to write the shortest solution? (a loop)
What would that look like with a repeat number times loop?
Can you explain how the code in Python works here?
Paired activity
Pupils should try this for themselves.
Set this task:
Find out what happens if:
you replace the 3 by a 2 or another number in Python.
you replace the word count by any other single word, e.g. number or times
you leave out the : at the end of the while line
Those pairs who have completed the task quickly can try Level 84.
Share and review
Discuss what they have found out about the while loop in Python.
What can change and what can stay the same?
Display the relevant Python Code Wall Cards on your display board.
Follow-up unplugged activity
Matching Blockly blocks to Python code with resource sheet UKS3–S11–2.
Print, laminate and cut up the Python cards for movement and loops, together with the corresponding Blockly cards. Give each pair/small group a set and ask them to match them up.
Last updated