Menu

Using Iteration (For Loops)

Card 1 of 16 0 got it 0 still learning
Question
TapClick or press space to see the answer
Answer
All 16 cards in this set
Which term describes a block of code that repeats a set number of times, decided before it starts?
Count controlled loop
Which term describes the punctuation mark that must come at the end of the first line of a for loop?
Colon
What is the name for the spaces at the start of a line that show the code belongs inside a loop?
Indentation
In the line for i in range(5):, what does range(5) set?
How many times the indented code is repeated
Which keyword starts a count controlled loop in Python?
For
When a loop draws a regular shape, what name is given to the angle the turtle turns through at each corner?
Exterior angle
Why is a for loop useful when drawing a shape such as a hexagon?
It repeats the same lines instead of copying them
Which line correctly starts a for loop that repeats 4 times?
for i in range(4):
In a for loop, which lines of code are repeated?
The indented lines underneath the for line
To draw a regular shape with a loop, the turn each time should be which value?
360 divided by the number of sides
How many times must a loop repeat to draw a circle using forward(1) and right(1)?
360 times
A loop uses for i in range(2): and turtle.right(90) to draw a square, but only half a square is drawn. What is the fix?
Change range(2) to range(4)
A loop is written with empty brackets, as in range(). What will happen?
Nothing is drawn because no repeat count is given
When one loop draws three separate squares, why is penup() used between them?
To move into position without leaving a line
A pupil draws an octagon with for i in range(8): but uses turtle.right(4) inside the loop. The shape comes out wrong. Which turn should be used instead?
45 degrees
A pupil writes for i in range(4) but forgets the colon at the end of the line. What happens when the program runs?
The program stops with an error