Display binary numbers (without calculations)

Challenge Level: Beginner

Learning outcomes

Students will be able to:

Requirement:

Create a program to display numbers 1, 2, 4, 8 and 16 on the screen, one at a time.

Testing examples:

The output will always show the numbers 1, 2, 4, 8 and 16 (there is no input).

Languages

Scratch

What it should look like

Click on the green flag to see the expected output of your program.

Recommended blocks
Hints
  • Click inside the block and type to change “Hello” to what you want to display on the screen. In this case, it will be ‘1’ for the first output, ‘2’ for the second, ‘4’ for the third and so on.

  • The number of seconds tells the output how long to show. The script waits that long before continuing.

  • Make sure all your blocks are “snapped” together in a line like a jigsaw puzzle.

  • Whenever you click the green flag, your script will start. To stop, click the stop button.

Show solution

Python

What it should look like

1
2
4
8
16
Hints
  • The print() statement allows you to display text or values within the parentheses on the screen. For example: print(100) would display 100 on the screen.
  • You will need to use a print() statement for each number you wish to display.

Show solution

Extra Challenge

Display the numbers from largest to smallest (display numbers 16, 8, 4, 2 and 1).