Challenge 3-2: Loops

Challenge 3-2: Loops

What are Loops?

Now here's another way to use logic in our code.

Loops are chunks of code that repeat a task over and over again.

  • Counting loops repeat a certain number of times.

  • Conditional loops keep going until a certain thing happens (or as long as some condition is True).

Loops are incredibly important, and used all over the place in programming. They effectively cut down on the amount of code you have to write, because instead of writing the same line of code three or four or however many times, you can just loop over it!