Hi,
Please help just starting out and have come up with the following code to create a simple guessing game.

on line 30 print good job etc i get a syntax error! sure it's simple but i've looked for ages and cant spot it!

Regards
Pete
# guess the number game
import random

guessesTaken = 0

print 'Hello what is your name?'
myName = raw_input()

number = random.randint(1, 20)
print 'Well, ' + myName + ', I am thinking of a number between 1 & 20.'

while guessesTaken < 6:
    print 'Take a guess.' # 4 spaces infront of print
    guess = raw_input()
    guess = int(guess)

    guessesTaken = guessesTaken +1

    if guess < number:
        print 'Your guess is too low,' # 8 spaces...

    if guess > number:
        print 'Your guess is too high.'

    if guess == number:
        break

if guess ==number:
    guessesTaken = str(guessesTaken)
    print 'Good job, ' +myName "! You guessed the number in " + guessesTaken + ' guesses!'

    if guess !=number:
        number = str(number)
        print 'Nope. The number I was thinking of was ' + number
        
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to