"Kyle Benak" <kbena...@yahoo.com> wrote

I am learning python and I am trying to write a simple "guess the number" game. I wrote the program in the IDLE, and I set the variable tries=1 to keep up with the number of tries it takes to guess the number, but when I try to run the program it gives the error message "improper syntax" and highlights the word
tries.

First please post the actual error in full, not just a rough summary.
Pythopn error messages are very informative and helpful once
you know how to read them. However, in this case its not needed.

The thing to remember with errors, especially syntax errors,  is that
Python reports them where it identifies the problem. But that may
be a line or so later than where the actual error occurs. That is
what happened here. Look at the guess= line and count the
parentheses....


num = random.randint(1,100)
guess = int(input('Take a guess: ')
tries = 1

print('Too low. Guess higher.')
guess=input('Take another guess: ')

you probably need to convert to int() here too...

HTH,

--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to