Skip to content
KALANBLON
Show contents

Chapter 6 of 6 · 10 min

Quiz: repeating

Do for and while loops hold no more secrets for you? Prove it! You need 70% correct answers, and you can try again.

Quiz

5 questions · pass mark: 70%

  1. 1.Which numbers does range(2, 6) produce?

    One answer

  2. 2.What does this program display?

    One answer

    total = 0
    for n in [4, 1, 5]:
        total = total + n
    print(total)
  3. 3.In which situations is a while loop the natural choice? (several answers)

    Several answers possible

  4. 4.Fill in the keyword that immediately stops the loop.

    Complete the code

    for n in numbers:
        if n < 0:
            ____
  5. 5.Why does this loop never stop?

    One answer

    i = 0
    while i < 3:
        print(i)

Your progress is saved on this device. Create a free account to keep your progress on all your devices.