6

Lesson 6 of 20 ยท Follow Steps

Follow Steps โ€” Part 14

Follow simple directions in order. This is part 14 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

  1. 1Run the code. We double 4 to get 8.
  2. 2Change n to 6. Run. Same steps, different input.
  3. 3Add a step: result2 = result + 1. Print it. Run.
  4. 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!

Follow Steps โ€” Part 14 โ€” Follow Steps | Pre-School Coding | LittleActivity | LittleActivity