During a storm you count the seconds between each flash and its thunder. You will make the program turn each count into a distance, find the nearest strike, and count how many strikes were closer than . Then it draws the distances as bars.
The idea. The light arrives almost at once, so the counted time is the sound's travel time: with .
Your tasks.
d, the distance of each strike, in metres.nearest, the distance of the nearest strike, in metres.close, how many strikes were less than away.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…