create a Python program that simulates a race by calculating the distance Usain Bolt and a series of animals have run along a track each second until Usain wins. The program will start by obtaining the track length from the user in meters. The program will then respond to the user pressing the enter key by computing the distance that Usain Bolt and a series of animals (the other “runners”) will have traveled in one second using an average speed (in other words, it will not take into account that it takes time to start running out of the block or that the splits aren’t all uniform). The program will display the current position, in meters, of each runner, and will show a string representation of the positions of the runners. Once Bolt has reached the end of the track, the program will no longer process user input.
In this lab, you’re going to create a Python program that simulates a race by calculating the distance Usain Bolt and a series of animals have run along a track each second until Usain wins. The program will start by obtaining the track length from the user in meters. The program will then respond to the user pressing the enter key by computing the distance that Usain Bolt and a series of animals (the other “runners”) will have traveled in one second using an average speed (in other words, it will not take into account that it takes time to start running out of the block or that the splits aren’t all uniform). The program will display the current position, in meters, of each runner, and will show a string representation of the positions of the runners. Once Bolt has reached the end of the track, the program will no longer process user input.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 4 images