Create a Basic Calculator in Scratch Blocks for Beginners

Scratch programming a calculator coding platform

Scratch Programming

The Scratch programming language is free, fun and easy to learn.

Most programming languages are text-based so a learner has to gain experience writing the code, but Scratch programming is easier as it uses blocks.

The learner selects blocks, puts them together and runs the program in a simple way making it the most fun and easiest way to learn programming.

Scratch Program: Calculator

As you may expect the calculator uses numbers with the operators (+ – * /) and the ‘join’ block.

The numbers are stored in variables which is another important programming concept.

Getting input from a user is not as common in Scratch or in programming but it is used.

download the instructions

Task #3 Calculator Walkthrough

  • The third video looks at creating a calculator.
  • The use of variables is constant for programmers whatever the programming language.
  • In this video the use of two variables provide the numbers that are then applied by an operator (+, -, * or /) to emulate a calculator.
  • Don’t forget to download and follow the instructions above.

If you can’t see the following video, it is available at this link: Learn Programming from Scratch #3 calculator

Here’s a summary of Dr Codie’s video, “How to Learn Scratch Programming Language – 3 Calculator,” in 10 bullet points:

1. **Task Overview**: The video demonstrates creating a calculator as part of a series on learning Scratch programming.

2. **Scratch Language**: Scratch is a beginner-friendly, block-based programming language that simplifies coding by using visual blocks instead of text.

3. **Core Concepts**: The video covers basic operators (addition, subtraction, multiplication, division) and variables (storage for values).

4. **Initial Setup**: Start by using the sensing block “ask and wait” to get the user’s choice of operation (e.g., plus, minus).

5. **User Input**: Prompt the user to enter the first number and store this in a variable (e.g., `a`).

6. **Second Input**: Similarly, prompt for the second number and store it in another variable (e.g., `b`).

7. **Output Display**: Use “say” blocks with “join” to display the operation and result (e.g., “5 + 5 = 10”).

8. **Code Duplication**: Duplicate and modify the code for different operations (minus, multiply, divide) to handle various user inputs.

9. **Testing**: Verify functionality by testing different operations and inputs to ensure the calculator performs correctly.

10. **Encouragement**: Viewers are encouraged to improve the calculator with their own ideas and to subscribe for more programming content.

Leave a Reply