Steven D'Aprano steve at
Thu Nov 20 07:47:12 CET 2014

On Wed, 19 Nov 2014 22:40:09 -0800, Karthik Reddy wrote:

> Hi all
> I am python beginner I am trying the below code and getting incorrect
> syntax in python (3.3.2)

You need to indent the while and if blocks.

Instead of writing:

while running:

you need to write:

while running:

See the indent? You should use either 1 tab or 4 spaces, but not both.

Another problem with your code, although it is not a syntax error, is 
that you have:

guess = int(raw_input('Enter an integer : '))

That is from Python 2. In Python 3, use:

guess = int(input('Enter an integer : '))

(don't forget to indent it correctly).

There may be other problems, please fix these first and if you have any 
other problems copy and paste the FULL error, everything from the line 


to the end of the error message.


More information about the Python-list mailing list