Coding Task: 01.01 Magic Number

Congratulations!

If you can read this screen, you have successfully begun your first coding activity and are ready to continue your exciting journey into the world of programming with CS in Schools!

The first activity that you’ll do is modify some Python code to perform a magic trick. SPOILER ALERT: the “magic” is actually just maths!

Your Task

In the editor below, fill in the blanks (________) so that the program does the maths trick described in the print commands and then print the result back to the user.

To test your code, Run the program by clicking on the Run button.

Requirements

  • The program should run without any errors.
  • Fill in the blanks to complete the code.
  • Enter a number between 1 and 20 in the your_number variable.
  • The program should then do some maths with that number, following the steps from the print commands. Finally, it should print the result back to the user!
  • The answer will show as 0.0 instead of 0, that’s okay!
  • Hint: programming sometimes uses different symbols for doing maths, for example * is for multiplication and / is for division! Try using // for division, what happens to the result?

Example

Below is an example of how the program should run:

I predict your FINAL ANSWER will be... ZERO!!!

Adding 2...
Tripling it...
Subtracting 6...
Dividing by 3...
Subtracting the original number...

I worked it out!

0.0

Was I correct??
Scroll to Top