course content

Course Content

Python Loops Tutorial

ChallengeChallenge
question-icon

Fill the `for` and `while` loops to print all the numbers from 0 to 20 in one row.

j = 0

# For loop
for i in
_ _ _

  print(i, end = ' ')

# New line
print(' ')

# While loop
while
_ _ _

  print(j, end = ' ')
  
_ _ _
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

Click or drag`n`drop items and fill in the blanks

dots
20
dots
21
dots
j < 20
dots
range(20)
dots
j += 1
dots
i + 1
dots
range(21)
dots
j == 20
dots
i += 1
dots
j < 21
dots
j + 1
dots
j > 21
down-icon

Section 3.

Chapter 1