A walk is written as a list of steps. Each step says how far you go east and north, in metres. You will make the program add up the distance you walked, find where you end up, and work out your displacement from the start.
The idea. The length of one step is . The distance adds up every step's length. The displacement is the straight line from the start to where you end: .
Your tasks.
distance.east and north.displacement.Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…