Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # my_wordscrable.py
- # this is the word scramble guess game with hints
- import random
- # A list of words to choose from to play the game with
- WORDS = ("helmet","dagger","car","oven","stroller")
- # pick one word randomly from the list
- word = random.choice(WORDS)
- # create a variable to use later to see if the guess is correct
- correct = word
- # create a jumbled version of the word
- jumble =""
- while word:
- position = random.randrange(len(word))
- jumble += word[position]
- word = word[:position] + word[(position) + 1:]
- print("Here we go. See if you can guess the word.")
- print("A hint is provided but if you don't need it, then ignore..")
- print("The jumble is: ",jumble)
- if "m" in jumble:
- print("This thing can protect the ole noggin..")
- elif "g" in jumble:
- print("Some thieves use them for silent wet-work.")
- elif "c" in jumble:
- print("Every teen hopes to get one when it is legal for them to use it.")
- elif "v" in jumble:
- print("It's good for making cakes, pies and breads.")
- else:
- print("Moms and nannies love these for taking the babies on walks.")
- guess = raw_input("\n\nYour guess is: ")
- while guess != correct and guess != "":
- print("Sorry, that's not it.")
- guess = raw_input("Your guess: ")
- if guess == correct:
- print("That's it! You guessed it!\n")
- print("Thanks for playing.")
- raw_input("\n\nPress the Enter key to exit.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement