Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #8494

Re: Python basic program problem

References <c07a7df7-0e26-4884-a237-cc0a1f148056@q14g2000prh.googlegroups.com>
From Noah Hall <enalicho@gmail.com>
Date 2011-06-27 08:18 +0100
Subject Re: Python basic program problem
Newsgroups comp.lang.python
Message-ID <mailman.438.1309159116.1164.python-list@python.org> (permalink)

Show all headers | View raw


On Mon, Jun 27, 2011 at 8:05 AM, Amaninder Singh <asingh0412@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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Python basic program problem Amaninder Singh <asingh0412@gmail.com> - 2011-06-27 00:05 -0700
  Re: Python basic program problem Noah Hall <enalicho@gmail.com> - 2011-06-27 08:18 +0100
  Re: Python basic program problem Daniel Kluev <dan.kluev@gmail.com> - 2011-06-27 18:19 +1100
  Re: Python basic program problem Andrew Berg <bahamutzero8825@gmail.com> - 2011-06-27 02:24 -0500
  Re: Python basic program problem Noah Hall <enalicho@gmail.com> - 2011-06-27 22:28 +0100

csiph-web