4

Lesson 4 of 20 ยท Do It Again

Do It Again โ€” Part 12

Learn about repeating actions. This is part 12 of 20.

What you'll learn

You will run a loop, change how many times it runs using range(), and understand that the code inside the loop runs once per time.

Steps

  1. 1Run the code. The loop runs several times.
  2. 2Change the number in range() to 5. Run. More steps.
  3. 3Change the message inside the loop. Run.
  4. 4Count: how many times did the loop run?

Key Terms

Loop
A way to repeat the same steps multiple times without writing them again and again.
range()
A Python built-in that gives you a sequence of numbers (e.g. 0, 1, 2) so the loop knows how many times to run.
Repeat
To do the same thing more than once. Loops help us repeat.
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!

Do It Again โ€” Part 12 โ€” Do It Again | Pre-School Coding | LittleActivity | LittleActivity