Python Loops
💡
Exercise 19

Detention 10 XP Easy

Ctrl+Enter Run Ctrl+S Save

A for loop repeats code a specific number of times. The range() function generates a sequence of numbers:

for i in range(5): print(i) # Output: 0, 1, 2, 3, 4

range(n) produces numbers from 0 to n-1. You can also specify a start: range(1, 6) gives 1, 2, 3, 4, 5.

Bart Simpson had to write lines on the chalkboard during detention. Let's recreate that!

📋 Instructions
Use a for loop to print this message **5 times**: ``` I will not throw paper airplanes in class. ``` Expected output (5 identical lines): ``` I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. ```
Use: for i in range(5): and then print the message inside the loop. You've got this — take it step by step!
⚠️ Try solving it yourself first — you'll learn more!
for i in range(5):
    print(i)
# Output: 0, 1, 2, 3, 4
🧪 Test Cases
Input
Run your code
Expected
I will not throw paper airplanes in class. I will not throw paper airplanes in class. I will not throw paper airplanes in class. ...
Expected output (5 lines)
main.py
Hi! I'm Rex 👋
Output
Ready. Press ▶ Run or Ctrl+Enter.