jammy
Junior Member
- Dec 5, 2008
- 127
- 99
at the moment , i am learning python from micheal dawson's e-book , and i need some help on the word jumble game
i dont see an error , but during execution , i am not able to make the program , display anything
can any one check it out for me ?
i dont see an error , but during execution , i am not able to make the program , display anything
can any one check it out for me ?
Code:
import random
WORDS = [ "apple" , "ball" ,"cat"]
word = random.choice(WORDS)
jumble = ""
correct = word
while word:
position = random.randrange(len(word))
jumble += position
word = word[:position] + word[(position + 1):]
print """ welcome to the jumble game"""
print " the jumbled word is" , jumble
guess = raw_input("\ntake a guess :")
guess = guess.lower()
while (guess != correct) and (guess != ""):
print " thats not the right word "
guess = raw_input("take a guess :")
guess = guess.lower()
if guess == correct:
print " thats right"
raw_input(" press a key to exit ")