En Sat, 24 May 2008 15:32:56 -0300, garywood <[EMAIL PROTECTED]> escribió:
> can someone explain why the tries displays the wrong number
> thanks
> orginally i started off with tries = 0 but it was off by 2
How would you count that if you were playing the game "for real"? I'd say that
you start (mentally) at 0 and count one more each time the other player says a
word.
In your code, there are *two* places where the player inputs his guess. A
common idiom is to rearrange the code this way:
tries = 0
...
while True:
guess = raw_input("Your guess: ")
tries += 1
# break out of the loop when player guesses
if guess==correct:
break
print "Sorry..."
....
print "You guessed it in", tries, "tries."
...
(instead of all those if/else, try to use a dictionary to hold the "hint"
corresponding to each word - you might even store several hints, as a tuple)
--
Gabriel Genellina
--
http://mail.python.org/mailman/listinfo/python-list