[Tutor] Syntax Question

Alan Gauld alan.gauld at blueyonder.co.uk
Thu Sep 11 22:45:54 EDT 2003


> #convert.py
> #   A program to convert Fahrenheit temperatures to Celsius
> --------------------------------------------------------------------
----------
> ------------------

I assume you don't really have all these dashes in your file?
If so Python will see them as minus signs and complain that
it doesn't understand... You would need to put # signs in
front to make them comments.

> def main():
>     Fahrenheit = input("What is the Fahrenheit Temperature?")
>     Celsius = (5.0 / 9.0) * Fahrenheit - 32
>     print "The Temperature is", Celsius, "degrees Celsius."

This all looks OK to me.

Alan G.




More information about the Tutor mailing list