Question: In python Assuming there are no accidents or delays, the distance a car travels down the interstatecan be calculated with the following formula:Distance = speed
In python
Assuming there are no accidents or delays, the distance a car travels down the interstatecan be calculated with the following formula:Distance speed x timeWhile the length of a trip would be calculated byTime distancespeedIn addition, lets assume the following are true:For every hours of travelling, speeding cars can get a ticket depending on howfast they are going. If they travel more than km per hour the ticket is $ while if theytravel more than km per hour it costs $Every hour of travelling consumes, on average, liters of gas for your make andmodel of car.Gas currently costs $ per literWrite a simple program that takes as input, the speed you plan to travel no need to input the distance and then outputs how long and how expensive it will be to travel thefollowing constant distances:kmkmkmYour solution must also do the following: Validate these the user input speed meets some logical criteria that you decide.hint: can you travel negative KMhour Still meet all expectations for style, comments and clarity in code. Use constants where appropriate. Provide a descriptive user experience eg if something goes wrong, the usershould be told what they did wrong so they can fix it in the futureTo help you succeed, a car travelling KMhour would expect to produce the followingoutputs:km hours for a cost of no ticketskm hours for a cost of no ticketskm hours for a cost of no tickets
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
