by BlastRoom
Students trace for and while loops in Python, tell count-controlled from condition-controlled loops and spot common loop errors.
#computing#ict#cambridge_computing#cambridge_computing_stage_8
20 questions
One question set, multiple game modes. Tap any game to see it in action. Not sure which to pick?
What is iteration in programming?
What does this code print? for i in range(3, 0, -1): print(i)
Which line starts a condition-controlled loop?
How many times does the loop for i in range(5): run?
What does this code print? for i in range(4): print(i)
What does this code print? for i in range(2, 6): print(i)
In for i in range(0, 10, 2):, what does the 2 do?
What does this code print? for i in range(1, 10, 3): print(i)
total = 0, then for i in range(1, 4): total = total + i. What is total after the loop?
When does a while loop stop repeating?
What is an infinite loop?
count = 0, then while count != 3: print("Hi"). This prints Hi forever. What is missing inside the loop?
n = 1, then while n != 8: n = n * 2. How many times does the loop body run?
A program must keep asking for a password until the user types the right one. Which loop fits best?
A program prints the 7 times table from 7 x 1 to 7 x 12. Which loop fits best?
How does Python know which lines belong inside a loop?
Which symbol must end the first line of a for or while loop in Python?
x = 0, then while x > 0: print(x). How many times does the loop body run?
To print 1 to 10, Sam writes for i in range(1, 10): print(i). What actually prints?
How many lines does this print? for letter in "cat": print(letter)
Outrun the horde and crack the passcode.
Pick a tile, answer, hit bonuses and steals.