• The capacity in gallons of a fuel tank
• The fuel efficiency in miles per gallon
• The price of a gallon of petrol
below is the code that i have written, can anyone double cheak, and to see wht can be changed and how it can be improved.i have also attched txt file, in order to see it clearer
Expand|Select|Wrap|Line Numbers
- print "----welcome----"
- capacity = input ("please enter the capacity of the fuel tank in gallons, gallons must be between 6 & 20:")
- while capacity < 6 or capacity > 20:
- capacity = input ("sorry invalid number,please enter gallons between 6 & 20:")
- efficiency = input ("please enter the fuel efficiency in MPG, efficiency must be between 20 & 75:")
- while efficiency < 20 or efficiency > 75:
- efficiency = input("sorry invalid number,please enter MPG between 20 & 7:")
- pricepergallon=input ("price per gallon of petrol? £, price must be between £3.20&4.20:")
- while pricepergallon < 3.20 or pricepergallon > 4.20:
- pricepergallon= input ("sorry invallid price,please enter price between £3.20 & £4.20:")
- carcango= capacity * efficiency
- print " on a full tank, the car can travel" ,carcango, "miles"
- print "the cost of travelling 100 miles is £", (100.0/efficiency *pricepergallon)
- print "end of program"