Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Python unexpected token and EOF errors.

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))
Get some IDE with syntax analyzer

http://i.piccy.info/i9/c157b5dc572e1647a...K9NIvO.png
(Aug 2, 2020 10:04 AM)Pernat1y Wrote:  Get some IDE with syntax analyzer

http://i.piccy.info/i9/c157b5dc572e1647a...K9NIvO.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!


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by Bass_ReevesAug 20, 2023 01:44 AM 9 630 Aug 20, 2023 01:44 AM
Last Post: Lucky4L
[Python] by SkunT3lloJun 29, 2021 01:59 PM 2 188 Jun 29, 2021 01:59 PM
Last Post: SkunT3llo
[Python] by TilcayoMar 16, 2020 04:20 AM 2 124 Mar 16, 2020 04:20 AM
Last Post: Tilcayo