Tasks for the examples
The examples in Tokbit are finished programs. A task that is identical to an example (say “write a program for the circumference of a circle” when the Circle example exists) invites copying in two clicks. The tasks here build on the examples: students have to understand them and change them.
The PRIMM approach
An example works well in five steps:
- Predict: the student opens the example, reads the flowchart and says what the program will do before running it.
- Run: they run it and compare the result with the prediction.
- Investigate: they step through it: before each step they say what will happen and check it in the Variables panel.
- Modify: they solve a follow-up task below.
- Make: they write their own program for a similar problem.
Stepping is the best check of understanding: “Before each step, say what will happen and how the variables change.” Someone who only copied the program can’t answer that.
Each task has a model solution: the link opens it in Tokbit (it asks first if you have unsaved work), or you can download it as a file. It is one possible solution; another correct one is just as good.
A complete lesson plan is in A lesson with Tokbit.
Beginner
Hello open the example
- Age next year. The program also asks for the age and answers, e.g. “Hello, Eva! Next year you will be 13.” Solution: open in Tokbit · download
- It knows itself. If you enter the name Tokbit, the program answers “That’s me!”, otherwise it greets as before. Solution: open in Tokbit · download
Sum of two numbers open the example
- All four operations. Also print the difference, product and quotient. When dividing by zero, say it is not possible instead of an error. Solution: open in Tokbit · download
- Which is larger. Instead of the sum, the program says which of the two numbers is larger, or that they are equal. Solution: open in Tokbit · download
Temperature converter open the example
- The other way round. Convert degrees Fahrenheit to Celsius: C = (F − 32) · 5 / 9. Solution: open in Tokbit · download
- Freezing or hot? Below 0 °C the program adds “It is freezing.”, above 30 °C “It is hot.” Solution: open in Tokbit · download
Circle open the example
- Diameter and a negative radius. Also print the diameter d = 2 · r. Try a negative radius: what does the program do and why? Solution: open in Tokbit · download
- Area of a ring. Ask for the outer radius R and the inner radius r and compute the area of the ring A = π · (R² − r²). The inner radius must be smaller. Solution: open in Tokbit · download
Pythagorean theorem open the example
- Perimeter and area of the triangle. Also print the perimeter p = a + b + c and the area A = a · b / 2 of the right triangle. Solution: open in Tokbit · download
- The missing leg. From the hypotenuse c and the leg a compute the other leg b = √(c² − a²). The hypotenuse must be longer than the leg. Solution: open in Tokbit · download
Even or odd open the example
- Divisible by three. The program also says whether the number is divisible by three. Solution: open in Tokbit · download
- Positive, negative, zero. Instead of even / odd the program tells whether the number is positive, negative or zero. How many conditions do you need? Solution: open in Tokbit · download
Countdown open the example
- Where to start. The program asks where to start counting down. Solution: open in Tokbit · download
- In twos. Count down in twos: 20, 18, 16 … 2. Changing one place in the program is enough. Solution: open in Tokbit · download
Sum of numbers open the example
- Even numbers only. Add up only the even numbers from 1 to n. You can use a condition in the loop, or a step in the range – try both. Solution: open in Tokbit · download
- Product instead of sum. Compute the product 1 · 2 · … · n (the factorial). What must the variable you multiply into start with? Solution: open in Tokbit · download
Rainbow open the example
- Stairs. Move each line one column to the right so the colours form stairs. The at(x, y) block helps. Solution: open in Tokbit · download
- A colourful name. Write your name so that each letter has a different colour. The letter at position i is name[i]. Solution: open in Tokbit · download
Intermediate
Largest number open the example
- The smallest too. Also find the smallest number in the list and print both. Solution: open in Tokbit · download
- Where is the largest. Also print the position of the largest number in the list (counting from 0). What extra does the program have to remember? Solution: open in Tokbit · download
FizzBuzz open the example
- How many Fizz. At the end print how many times the program wrote Fizz, Buzz and FizzBuzz. Solution: open in Tokbit · download
- The Boom game. Instead of the number write “Boom” when it is a multiple of seven or contains the digit 7 (17, 27, 70 …). Hint: "7" in str(i). Solution: open in Tokbit · download
Times table open the example
- One row. The program asks for a number and prints only its multiples: 1 × 7 = 7 … 10 × 7 = 70. Solution: open in Tokbit · download
- Addition table. Change the program to add instead of multiply. Which two things do you need to change so the table stays aligned? Solution: open in Tokbit · download
Guess the number open the example
- Only seven guesses. The player has only 7 guesses. If they miss, the program tells the number. (The task from the Lesson with Tokbit.) Solution: open in Tokbit · download
- Your own range. At the start the player chooses the upper limit (say 1000). How many guesses are enough when you halve the interval? Solution: open in Tokbit · download
Hangman open the example
- Your own words. Add five words of your own to the list. They must be in capitals – why? Solution: open in Tokbit · download
- How many misses. After a win the program also prints the number of misses, e.g. “You won! Misses: 2” Solution: open in Tokbit · download
Mastermind open the example
- Only eight tries. Make the game harder: the player has only 8 tries. Which place in the program decides it? Solution: open in Tokbit · download
- In how many tries. After cracking the code the program says how many tries it took. Solution: open in Tokbit · download
Average of grades open the example
- Best and worst. Also print the best and the worst grade. min() and max() help, or your own loop. Solution: open in Tokbit · download
- In words. Add a word by the average: up to 1.5 “excellent”, up to 2.5 “good”, otherwise “work harder”. Solution: open in Tokbit · download
Melody open the example
- Twice as fast. Play the tune twice as fast without rewriting the list of lengths. Solution: open in Tokbit · download
- A scale. Play the C major scale up and back down: C4 D4 E4 F4 G4 A4 B4 C5. One list of notes and two loops are enough. Solution: open in Tokbit · download
Rectangle open the example
- A third frame. Draw a third frame: a 6 × 6 square in the top right corner, in another colour. Don’t change the function, just call it. Solution: open in Tokbit · download
- A filled rectangle. Write a new function filled(x, y, width, height) that fills the whole rectangle with # and draw a rectangle with it. Solution: open in Tokbit · download
Ball open the example
- Two balls. Add a second ball (sprite 1) in another colour that starts elsewhere and flies in another direction. Solution: open in Tokbit · download
- Colourful bounces. At every bounce the ball changes to a random colour (randint). Solution: open in Tokbit · download
My Sprite open the example
- Rocket launch. Make the rocket take off from the bottom to the top instead of flying sideways. What do you swap in the loop? Solution: open in Tokbit · download
- Your own shape. Draw your own sprite in the shape block – a heart, say – and change its colour. Solution: open in Tokbit · download
Aquarium open the example
- A seventh fish. Add a seventh fish to the aquarium. Which lists must get longer and what else must change? Solution: open in Tokbit · download
- Calm water. Make the fish swim only horizontally and slower. Changing the numbers in the lists is enough, no code. Solution: open in Tokbit · download
Arrows open the example
- Drawing with a trail. Make the star leave a trail so you can draw with the arrows. What is enough to remove from the program? Solution: open in Tokbit · download
- Step counter. Count how many times the star really moved (it does not move at the edge) and print the number of steps at the end. Solution: open in Tokbit · download
Calculator open the example
- Power. Add the option “Power” to the menu, computing a to the power of b (a ** b). Quit becomes number 6. Solution: open in Tokbit · download
- Checking the choice. Try option 7 or a letter. What does the program do and which block handles it? Then add a counter of calculations and print it on Quit. Solution: open in Tokbit · download
Geometry open the example
- Cuboid. Add a Cuboid: from three edges compute the volume V = a · b · c and the surface S = 2 · (ab + bc + ac). Write two functions with a return value for it. Solution: open in Tokbit · download
- A function for the square. For the square the program calls the rectangle functions with equal sides. Write your own functions square_perimeter and square_area and use them. The results must not change. Solution: open in Tokbit · download
Cash machine open the example
- Hundreds only. The machine only gives out 100 CZK notes: it refuses an amount that is not a multiple of 100. Solution: open in Tokbit · download
- Your own PIN. Add the option “Change PIN”: the program asks for a new PIN and accepts it only if it has 4 digits. Solution: open in Tokbit · download
Factorial open the example
- Every factorial. Print the factorials of all numbers from 1 to 10, not just every fifth. What do you change in the loop range? Solution: open in Tokbit · download
- Power by recursion. Write a similar function power(b, n) computing bⁿ by recursion: b⁰ = 1, bⁿ = b · bⁿ⁻¹. Print the powers of two up to 2¹⁰. Solution: open in Tokbit · download
How old are you open the example
- Coming of age. The program adds whether the person is an adult and, if not, in which year they turn 18. Solution: open in Tokbit · download
- Age in days. Estimate how many days you have lived: age · 365. Why is it only an estimate? Solution: open in Tokbit · download
Clock open the example
- Date with zeros. Print the date as 05/03/2026 – use the function the program already has. Solution: open in Tokbit · download
- Enjoy your meal. At noon (from 11 to 13 o’clock) the program wishes “Enjoy your meal!” instead of the greeting. Where in the function does the condition go? Solution: open in Tokbit · download
- Quarter hours. Make the marks at 12, 3, 6 and 9 yellow, the others stay white. Which function do you change, and how does the loop tell a quarter hour? Solution: open in Tokbit · download
Shopping list open the example
- No duplicates. An item already in the list is not added; the program says “Already in the list.” Solution: open in Tokbit · download
- Clear. Add the option “Clear” that deletes the whole list. Quit becomes number 6. Solution: open in Tokbit · download
Search in a list open the example
- The last match. Find the last match instead of the first. Going through the list from the end is enough. Solution: open in Tokbit · download
- Finding a name. Change the program to search for names in a class (a list of texts). What else do you need to change besides the list? Solution: open in Tokbit · download
Bubble sort open the example
- Descending. Sort the numbers from the largest. Changing a single character is enough. Solution: open in Tokbit · download
- How many swaps. Count how many times neighbours were swapped and print it. How many swaps does an already sorted list need? Solution: open in Tokbit · download
Simon open the example
- A harder start. Make the game start with a sequence of three fields, not one. Solution: open in Tokbit · download
- A slower game. Make the game never speed up below 300 ms per field. Find the place where the light-up length is computed. Solution: open in Tokbit · download
Moon landing open the example
- Less fuel. Make landing harder: the module has only 60 units of fuel. Solution: open in Tokbit · download
- A heavier Moon. Raise gravity to 0.08 and try whether you can still land. What else would you have to change to make it possible? Solution: open in Tokbit · download