[Tutor] why do i keep getting syntax errors in python when this runs

Joel Goldstick joel.goldstick at gmail.com
Fri Sep 6 19:25:05 CEST 2013


On Fri, Sep 6, 2013 at 12:27 AM, mike johnson <pretorian at hotmail.com> wrote:
> can you please help me figure out why this isnt working thanks

You have tthree problems:

> # convert.py
> # this program is used to convert Celsius temps to Fahrenheit
> # By: James Michael Johnson
>
> Def main ():

The keyword is def, not Def, so rewrite like:
def main():

> Celsius = float (input ("What is the Celsius temperature? "))
> Fahrenheit = 9.0 / 5.0 * Celsius + 32
> Print ("The temperature is ", Fahrenheit, " degrees Fahrenheit.")
>
>
You have not indented the suite of code that runs in main, so set your
editor to print 4 spaces when tab is pressed, and tab each line under
main.


> Main ()


You defined main() but you called Main.  Python is case sensitive, so
change this to main()
>
>
>
>
>
>
>
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>



-- 
Joel Goldstick
http://joelgoldstick.com


More information about the Tutor mailing list