# [Tutor] Need help with code.

Raj Medhekar cosmicsand27 at yahoo.com
Fri Jun 19 22:42:56 CEST 2009

```Hi, I need help with the code below. I am trying to pair the list in the hint with the list of words. However, the list is not matching up correctly. Also when the correct guess is entered the program just continues without acknowledging the right answer. Please could y'all test this out and let me know where I am going wrong.  I also want to add a scoring system where the computer rewards the person that guesses without getting a hint. Any suggestions as to how I might go about incorporating that into my code. Thanks for the help!

Peace,
Raj

# Word Jumble V2
# Computer jumbles a randomly selected word then asks the player to guess it
# If player cant guess the word he can ask for a hint
# Scoring system that rewards players for solving jumble without a hint (not included in this code)

import random

WORDS = ("sweep","difficult", "python", "america")
HINTS = ("remove dirt","not easy","computer language and a snake",
"land of the free")

word = random.choice(WORDS)
correct = word
jumble = ""

while word:
position = random.randrange(len(word))
jumble += word[position]
word = word[:position] + word[(position+1):]
for word in WORDS:
HINTS[position] == WORDS[position]

print\
"""
Welcome to Word Jumble
Unscramble the letters to make a word
(Press the enter key at the prompt to exit)
"""
print "The jumble is: ",jumble
guess = raw_input("Guess the word: ")
guess = guess.lower()
tries = 1
while guess != word and word !="" and tries <5:
print "Sorry! That's not it!"
guess = raw_input("Guess the word: ")
guess = guess.lower()
tries +=1
if guess == correct:
print "You're right, the word is", word
else:
print "Maybe you need a hint:"
print HINTS[position]
guess = raw_input("Guess the word: ")
guess = guess.lower()

raw_input("\n\nPress the enter key to exit:")

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090619/eca8a099/attachment.htm>
```