Skills101
← All practice quizzes

Quiz: Python Loops

5 questionsNo time limitPass: 60%+10 XP on first pass

Repeat work with for and while loops. Understand range() with a picture, loop over lists and strings, use break, continue and else, and write nested loops for patterns.

Log in to take the quiz

Free account · see your score, answers and explanations, earn XP

  1. Question 1

    What does this print?

    for i in range(3):
        print(i, end=" ")
    
  2. Question 2

    How many times does the body run? for i in range(2, 20, 3):

  3. Question 3

    What does this print?

    i = 0
    while i < 5:
        i += 2
    print(i)
    
  4. Question 4

    What does this print?

    for n in [1, 2, 3, 4]:
        if n == 3:
            continue
        print(n, end="")
    
  5. Question 5

    When does the else block of a for loop run?