Hack Forums
[Python] Python unexpected token and EOF errors. - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Python] Python unexpected token and EOF errors. (/showthread.php?tid=6099625)



Python unexpected token and EOF errors. - Treasuretrio - Aug 2, 2020

Hey everyone, I'm trying to learn python and i'm going through the 'Automate the boring stuff with python' book right now, this was one of the sample projects, but for some reason it has a problem with my last line, i'm getting unexpected token errors and EOF errors after that. I'm expecting it to be a small dumb mistake but i've looked over it 100 times and cannot figure out what it is.

Code
#Guess the number game
import random

print('Hello what is your name?')
name = input()

print('Well, ') + name + ', I am thinking of a number between 1 and 20'
secretNumber = random.randomint(1, 20)

for guessesTaken in range(1, 7):
   print('Take a guess.')
   guess = int(input())

   if guess < secretNumber:
       print( name + ' Your guess is too low.')
   elif guess > secretNumber:
       print:(name + ' Your guess is too high.')
   else:
       break # this condition is for the correct guess


if guess == secretNumber:
   print('Good job' + name + ('You guessed my number in' + str(guessesTaken) + ' Guesses')
else:
   print('No the number I was thinking of was ' + str(secretNumber))



RE: Python unexpected token and EOF errors. - Pernat1y - Aug 2, 2020

Get some IDE with syntax analyzer

http://i.piccy.info/i9/c157b5dc572e1647aa7fe5c16bb9dc6e/1596387701/16870/1387862/pycharm64_M3U2K9NIvO.png


RE: Python unexpected token and EOF errors. - Treasuretrio - Aug 2, 2020

(Aug 2, 2020 10:04 AM)Pernat1y Wrote:  Get some IDE with syntax analyzer

http://i.piccy.info/i9/c157b5dc572e1647aa7fe5c16bb9dc6e/1596387701/16870/1387862/pycharm64_M3U2K9NIvO.png

Ohhhhh, thank you for the awnser I was clawing my eyes out. yeah its obvious now, i'll look into getting one of those asap, looks very useful. Thanks again!