A student is writing a Mars Rover simulation in Python.
| 0 | 1 | 2 | 3 | 4 | 5 | 6 |
|---|---|---|---|---|---|---|
| S | S |
0 in a list of sectors representing a path.1 or 3 to command the rover to move forward by that many sectors:
1 increases the rover's position by 1.3 increases the rover's position by 3.'S'):
Stuck! is displayed0position = 0
final_sector = len(path) - 1
while position < final_sector:
Extend the program from Figure 3 so that the simulation works as described in Figure 2.
When writing your program you should assume:
path'S' characters in path can vary'S' characters in path can vary'S' characters have already been added to the list called pathpath list can be of any length.You should use indentation as appropriate, meaningful variable name(s), and Python syntax in your answer.
298 exam-style questions on AQA GCSE Computer Science Programming concepts. Each one has a worked solution and a mark scheme showing where the marks go.