[Tutor] Syntax error

Mark Tolonen metolone+gmane at gmail.com
Mon Mar 23 05:18:01 CET 2009


It is helpful to know the exact error message (cut and paste) and the version of Python you are using.  In Python 3.x the print statement would produce a syntax error.  In any Python "raw input" is a syntax error.  "raw_input" is the correct function name, unless you are using 3.x where it was renamed to "input".

In Python 2.x:

    print "Game Over"
    raw_input("\n\nPress the enter key to exit.")

In Python 3.x:

   print("Game Over")
   input("\n\nPress the enter key to exit.")

-Mark 
  "John Jenkinson" <johnjenkinson1 at gmail.com> wrote in message news:58fd32380903222035k591f65b1x13f4e3b8b70b21ab at mail.gmail.com...
  I am trying to write a program that displays the string expression "Game Over", in a console window that remains open.

  my code is as follows:

  # Game Over console window

  print "Game Over"
  raw input("\n\nPress the enter key to exit.")




  The error I am recieve is "There is an error in your program: invalid syntax".

  I dont understand what is supposed to happen if the code were to be correct.  Would a separate console be displayed with the text "Game Over", or would I see the output in the Interactive Mode window?

  Excuses my noviceness,  I just started using python tonight. 


------------------------------------------------------------------------------


  _______________________________________________
  Tutor maillist  -  Tutor at python.org
  http://mail.python.org/mailman/listinfo/tutor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090322/56de693c/attachment.htm>


More information about the Tutor mailing list