Question: Python Only please !! Assume that the following locations are on a straight line and the distance specified from where you are now (for example
Python Only please !!
Assume that the following locations are on a straight line and the distance specified from where you are now (for example location A is 1 mile away from you, location B is 23 miles away from you and 22 mies away from location A. locations = {'A': 1, 'B': 23, 'C': 56, 'D': 89, 'E': 101, 'F': 123, 'G': 156, 'H': 203, 'I': 225, 'J': 277, 'K': 315, 'L': 351, 'M': 388, N': 400, 'O': 427, 'P': 470, 'Q': 499, 'R': 529, 'S': 555, 'T': 579, 'U': 598, 'V': 604, 'W': 620, 'X': 649, 'Y': 677, 'Z': 700}
In this assignment you are to determine how many locations the user can visit given the number of gallons of fuel in their cars fuel tank and the average number of miles their vehicle travels per per gallon of fuel. You must ask the user to enter the number of gallons of fuel in their vehicles fuel tank and the number ask the user to enter the average number of miles their vehicle travels per per gallon of fuel. You must use while loops to trap the user until valid (>= 0) values for the number of gallons of fuel in their cars fuel tank and the average number of miles their vehicle travels per per gallon of fuel are entered. You are to output the locations they may travel to before they run out of fuel.
Here's the output:
Please enter the number of gallons of fuel in your tank: 20
Please enter the number of miles per gallon: 10
The maximum number of miles you can travel is 200.0
You can travel to: A which is 1 miles away.
You can travel to: B which is 23 miles away.
You can travel to: C which is 56 miles away.
You can travel to: D which is 89 miles away.
You can travel to: E which is 101 miles away.
You can travel to: F which is 123 miles away.
You can travel to: G which is 156 miles away.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
