Quiz: Repeat Yourself

Test your understanding of Python loops!

We'll cover the following...

In the last lesson, you learned how to use loops to repeat actions in your code without writing the same line repeatedly. You practiced with for loops (when you know how many times to run something) and while loops (when you want to keep going until a condition changes).

Now, let’s see how well you remember with a quick quiz!

Technical Quiz
1.

What does this code do?

for i in range(3):
    print("Hi!")
A.

Prints "Hi!" 2 times.

B.

Prints "Hi!" 3 times.

C.

Prints "Hi!" 4 times.


1 / 3

Nice work! You’ve learned how to use for and while loops to repeat code efficiently—one of the most powerful tools in any programmer’s toolkit.

What’s next?

Now it’s your turn to put loops into action! In this hands-on project, you’ll create your own custom loop. You can:

  • Print your name multiple times.

  • Count by 2s.

  • Create a loop that runs until the user types “stop”.

It’s a fun way to explore how loops can make your code smarter, shorter, and more flexible. Let’s keep looping forward!