×

Challenges

  1. Not started

  2. Not started

  3. Not started

  4. Not started

  5. Not started

  6. Not started

  7. Not started

  8. Not started

  9. Not started

  10. Not started

  11. Not started

  12. Not started

  13. Not started

Challenge 2.1

Display number of dots for a given number of cards

Challenge Level: Growing experience

Requirement:

Write a program to display numbers 1, 2, 4, 8,... (one at a time) for a given number of cards entered as the input.

Hints
  • Make a variable called “number of cards” to store the number of cards to display entered by the end user as the input (e.g. 5) and a variable called “number of dots” to store the number of dots (e.g. 1, 2, 4, 8, 16) where each number is calculated by multiplying the previous number by 2.

  • In this challenge, use the 'Ask and wait for number' block to receive an input from the user. Replace the text “What’s your age?” with your own question. You can then set the value of this block to the variable "number of cards" Use a 'Repeat' loop, repeating the blocks inside (displaying the number of dots) “number of cards” times.

Programming Reminders

Output statements

Output a string directly
Blocks showing how to output a string
Output a variable
Blocks showing how to output a variable

Variables

Set a variable as a string
Blocks showing how to set a variable as a string
Set a variable as an integer
Blocks showing how to set a variable as an integer
Set a variable from a calculation
Blocks showing how to set a variable from a calculation
Set a variable from a user input (text)
Blocks showing how to set a variable from a user input (text)
Set a variable from a user input (number)
Blocks showing how to set a variable from a user input (number)
Add one to a value
Blocks showing how to add one to a value

Conditionals

Find out the discount on fruit
Blocks showing how to use conditional blocks

Loops

Output string 10 times
Blocks showing how to output a string
Output number until number reaches 10
Blocks showing how to output a string
Recommended Blocks
Number block
String block
Ask and wait for number block
Say block
Multiply block
Set variable to block
Custom variable block
Repeat block

Create your program in the editor below

Your submission results will be displayed here

Input Expected output Received output Status
5
1
2
4
8
16

                
Not yet run ?
8
1
2
4
8
16
32
64
128

                
Not yet run ?
1
1

                
Not yet run ?