looking for advice python

twiztidtrees at gmail.com twiztidtrees at gmail.com
Sat Jan 26 23:26:41 CET 2013

Hey I'm new to programming and I have been working on calculating miles per gallon. iv posted below what I have and constructive criticism would be wonderful. Thanks

#This is a program used to calculate miles per gallon

#variable used to gather miles driven 
string_miles = input('How many miles did you drive?')

#variable used to gather the amount of gallons used 
string_gas = input('How many gallons of gas did you use?')

#used to convert the miles input
miles = int(string_miles)

#used to convert the gas input
gas = int(string_gas)

#used to calculate mpg through division
mpg = miles/gas

print('Your miles per gallon is', format(mpg,'.2f'))

More information about the Python-list mailing list