On Mon, Jun 27, 2011 at 8:05 AM, Amaninder Singh <asingh0...@gmail.com> wrote: > Hi, > I am fairly new to python, I am trying to write simple code and It is > giving me syntax error. I am reading a book and following the > directions as it says in the book but I am not sure why it is not > working. Please guide me through. Any help appreciated. >>>> x = 2 >>>> if x == 2: > print "This is a test" > > SyntaxError: invalid syntax >>>> if x == 2: > print "This is a test" > > SyntaxError: invalid syntax >>>> x = 2 >>>> if x = 2: > > SyntaxError: invalid syntax >>>> if x == 2: > print "This is test" > > SyntaxError: invalid syntax >>>> Type "copyright", "credits" or "license()" for more information. > SyntaxError: invalid syntax >>>> >>>> >>>> print "this is a test" > SyntaxError: invalid syntax >>>> import keyword >>>> print keyword.kwlist > SyntaxError: invalid syntax >>>> print "hellow world" > SyntaxError: invalid syntax >>>> print 'hellow world' > SyntaxError: invalid syntax >>>> Looks like you're using the 3.x version, while your guide is 2.x. I suggest you download the 2.x version, or find a new tutorial.
HTH -- http://mail.python.org/mailman/listinfo/python-list