[Tutor] What's going on with this code? Error message supplied.

Alan G alan.gauld at freenet.co.uk
Mon Jul 11 00:53:44 CEST 2005


>  Here's an error message:
> 
>    File "D:\GC.py", line 78
>      cal_opt = cal_menu()
>      ^
>  SyntaxError: invalid syntax
> 
>  The relevant code:
> 
>  option = main_menu()
>  if option == 1:
>      cal_menu()
>          cal_opt = cal_menu()

Consistent indentation is all important in Python
Move the linees under the if statement into alignment:

  if option == 1:
      cal_menu()
      cal_opt = cal_menu()

My tutor discusses this in the topic on 'Loops'

HTH,

Alan G
Author of the Learn to Program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld


More information about the Tutor mailing list