[Tutor] Need Assistants with Python Please
Emile van Sebille
emile at fenx.com
Sun Mar 15 16:53:25 CET 2009
Jared White wrote:
> Good Morning Everyone,
>
> I am having a little issue with Python,
Actually, two...
>
> Hopefully Someone Can Help Me....
>
> I am trying to Develop a Python program that converts a single fuel
> rating from mpg to lp100km.
>
> So far ive come up with this code. But it seems not to be working, Can
> someone please help me figure out what ive done wrong
>
> def main ():
> print "The program converts Miles Per Gallon (US) to Liters Per 100
> Kilometer."
> kilometers = input ("What is the Miles Per Gallon?")
Review the use of input at
http://docs.python.org/library/functions.html?highlight=input#input
> MilesperUSGallon * (1.60934/3.78541) = kilometersperliter.
> 1/(kilometers per liter) = liters per kilometer. Liters/kilometer * 100
> = liters per 100 km.
Read up a little on variable usage. Start at
http://docs.python.org/tutorial/introduction.html
HTH,
Emile
More information about the Tutor
mailing list