×

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.2

Display number of dots from right to left in one line

Challenge Level: Growing experience

Requirement:

Write a program to display numbers 1, 2, 4, 8,... (all in one line) for a given number of cards as the input.

Hints
  • Make variables:

    • “number of cards” to store the number of cards to display entered by the end user as the input (e.g. 4).
    • “number of dots” to store the number of dots.
    • “binary cards” which is a variable type string and stores what is going to be displayed on the screen as the output (e.g. “1, 2, 4, 8,”).
  • Use the 'Join' block under “Operators” to combine two strings. You can use multiple join blocks inside each other if you need to combine more than two strings.
  • To concatenate data together you use the 'Join' block. This can be used to join text and variables. Remember to check if the spaces are correct between the items being joined!
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
Join string 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
1
1, 

                
Not yet run ?
4
1, 2, 4, 8, 

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

                
Not yet run ?