I am new to python(version 3.2.11) and having some problems with this code...Please Help!!
Here is the program I am supposed to write: Write a program which computes the fuel efficiency of a multi-leg journey. The program will prompt the user for the starting odometer reading and then for information about each leg in the journey. For each leg, prompt the user for the current odometer reading and the amount of gas they used. The program knows there are no more legs in the journey when the user enters no input for a leg. The program is to print out the miles per gallon achieved on each leg of the journey and the total miles per gallon for the trip.
def main():
stmi = input("Please enter the starting odometer reading: ")
tgas = 0.0
if stmi != "":
legmi, gas = input("Please enter the leg miles and the gas (leg miles,gas) or press enter for total miles per gallon: ")
if legmi != "":
dist = legmi - stmi
lmpg = dist/gas
while legmi != "":
tgas = tgas + gas
print ("The miles per gallon of the leg is ", lmpg)
stmi = legmi
legmi, gas = input("Please enter the leg miles and the gas (leg miles,gas) or press enter for total miles per gallon: ")
else:
tmpg = (legmi - stmi)/tgas
print ("The total miles per gallon is ", tmpg)
main()