How to run it in class
10 min- 1Read the puzzleMake a hold 7 and b hold 3.
- 2Try itStudents write code without typing the numbers.
- 3Run to checkHint: you might need a third variable.
Why it works
Swapping two values is a classic puzzle that shows how variables work. Finding the need for a third variable is a real moment of understanding.
Ideas to adapt it
- Try swapping three values.
- Swap in Python with one line.
- Explain the swap with two cups and a jug.
Questions
How long does it take?
About 10 minutes. It stays saved in your lesson, so you can come back to it next time.
Can I use it with one student?
Yes. Try it with two cups of water first.
Do students need an account?
No. Go live and share the link or the code. Students join from any device with nothing to install, and you can give each of them their own copy.
Is this starter free?
Yes. Open it, change anything and teach with it on the free plan, which has every feature and live lessons with up to 5 students. Try it first needs no account.
More coding starters
See all
Write a function
Fill in a function and test it
Use this starter
Python: predict the output
A short Python program to guess, then run
Use this starter
Flow chart
Start, steps, a yes or no question, and the end
Use this starter



