can someone explain why the tries displays the wrong number thanks orginally i started off with tries = 0 but it was off by 2
# Word Jumble # # The computer picks a random word # The player has to guess the original word can give hint import random tries = 1 # create a sequence of words to choose from word = ("python", "jumble", "xylophone", "difficult", "answer") # pick one word randomly from the sequence word = random.choice(word) # create a variable to use later to see if the guess is correct correct = word # start the game print \ """ Welcome to Word Jumble! (Press the enter key at the prompt to quit.) """ if word == "python": hint = 'snake' if word == "jumble": hint = 'mess' if word == "difficult": hint = 'hard' if word == "answer": hint = 'correct' if word == "xylophone": hint = 'music' guess = raw_input("\nYour guess: ") guess = guess.lower() while (guess != correct) and (guess != ""): print "Sorry, that's not it." + hint guess = raw_input("Your guess: ") guess = guess.lower() if guess != correct: print hint tries += 1 if guess == correct: print "That's it! You guessed it!\n" print "Thanks for playing." print tries raw_input("\n\nPress the enter key to exit.")
-- http://mail.python.org/mailman/listinfo/python-list