Skip to main content
Codepiko
TR
All activities

To save a PDF, choose "Save as PDF" as the destination in the print window.

Codepiko · World 3: Master Center

Shortcut master

Goal: Make a working program shorter and repeat until a condition ends.

Time: 25 min · You need: Pencil

Name:
Class:
Date:

1. Find a shorter path

This program gets the robot to the goal, but it wanders a lot. How many commands does it have? Find a shorter program and write it in the boxes.

SG

S: start, G: goal

Program

↑↑↑↑↑→→→→→↓↓↓↓↓

Your program

2. Until the condition ends

The program multiplies the number by two each round and keeps going while the number is less than 20. Write the number at the end of each round in the table. How many times did the loop run?

number = 1
repeat while number < 20:
    number = number × 2
Roundnumber
1
2
3
4
5
6

The loop ran ______ times.

codepiko.com