I need to create a Python program that will determine the race winner using the odometer_miles = odometer_miles + speed * time equation and with a class called Car that has “common miles spaces”, “speed”, “driver name” and “sponsor” attributes.
The variable speed is a number from 0 to 120 (mph), which is randomly generated every minute. Then the equation is executed again, updating the odometer_miles variable.
Once the odometer_miles variable reaches 500 (or the closest value is greater than 500) miles, the race will end, and whichever rider (from group 20) reaches 500 is declared the winner. When a winner is determined, the program needs to type “driver name” and “sponsor”.
I think I created the class correctly, but the rest of the program far exceeds my capabilities. My textbook is less useless, and I have no way to contact my professor. I spent the last few hours trying to figure it out to no avail.
This is what I have so far:
class Car: def __init__(self, odo_miles, speed, driver, sponsor): self.odo_miles = odo_miles self.speed = speed self.driver = driver self.sponsor = sponsor
If someone can show me how to do this, with only two riders or enough so that I can complete for all 20 riders, I would always be grateful.
Thank you so much for your help!
source share