16
Lesson 16 of 20 · Simple Algorithms
Simple Algorithms — Part 5
Design a step-by-step plan to solve a problem. This is part 5 of 20.
What you'll learn
You will learn that an algorithm is a reusable set of steps that solves a problem for any input.
Steps
- 1An algorithm is a set of clear steps to solve a problem. Here the problem is: double a number. The steps: take n, multiply by 2, show result.
- 2If n is 4, then result = 4 * 2 = 8. The output would be 'Start: 4' then 'Double: 8'.
- 3The beauty of an algorithm: change n to 6, and the same steps give 'Double: 12'. Same recipe, different ingredients!
- 4Algorithms are everywhere: a recipe is an algorithm for cooking, turn-by-turn directions are an algorithm for driving. Code is algorithms for computers!
Key Terms
- Algorithm
- A clear set of steps that solve a problem. Same steps work for different inputs.
- Input
- The data you give to the program (e.g. the number n).
- Result
- What the program produces after following the steps.
Python 3
Output
Loading Python... This may take a few seconds.
Your code runs only in your browser. No code is sent to any server. Stay safe and have fun learning!
Ready?
Simple Algorithms — Part 5
You will learn that an algorithm is a reusable set of steps that solves a problem for any input.
Full screen — no distractions
🖨️View in Shop
Checkout complete lesson on Simple Algorithms for 5th Grade
Get the full Simple Algorithms track as a printable PDF — all lessons, worksheets, and answer keys.
