2
Lesson 2 of 20 ยท Follow Steps
Follow Steps โ Part 10
Follow simple directions in order. This is part 10 of 20.
What you'll learn
You will run an algorithm that doubles a number, change the input and see the result change, and add one more step to the algorithm.
Steps
- 1Run the code. We double 4 to get 8.
- 2Change n to 6. Run. Same steps, different input.
- 3Add a step: result2 = result + 1. Print it. Run.
- 4An algorithm is clear steps that always work.
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). The algorithm uses it to produce a result.
- Result
- What the program produces after following the steps (e.g. the doubled number).
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!
