turn_rightare, in fact, procedures. Once called, they cause the van to move. This is why when we want the van to move forwards, we call its
move_forwardsprocedure by putting () after its name (e.g.
nis a whole number such as 3. It works with any name inserted where the word number is shown in the example. (The built-in range function just tells the loop how many times to repeat.)
v.move_forwards()3 times. You can use the count variable inside the body of the loop if you want the van’s behaviour to differ depending on how many times the for loop was executed. On the first time through the loop, its value will be 0, incremented by one each time around the loop.
elsestatements must all be indented to the same level as each other, and all require a colon : at the end of their statement.
whilenot statement repeats until the condition is
whilecondition is met (we call it the body of the loop).
defkeyword. The procedure needs a meaningful name where
procedurenameis placed in the example. You must have a pair of brackets () and a colon : after it.