Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #coding: utf8
- from random import randint
- guessWord = str(raw_input("Enter the word to guess: "))
- tries = 0
- shuffledGuessWord = ""
- keyUsed = []
- while len(shuffledGuessWord) != len(guessWord):
- keyAlreadyInArray = False
- key = randint(0, len(guessWord)-1)
- for i in range(0, len(keyUsed)):
- if key == keyUsed[i]:
- keyAlreadyInArray = True
- if not keyAlreadyInArray:
- shuffledGuessWord += guessWord[key]
- keyUsed.append(key)
- print shuffledGuessWord
- while str(raw_input("Enter the right word: ")) != guessWord:
- tries += 1
- print("Wrong word!")
- print ("Try #"+str(tries))
- print("You found the right word! It was indeed "+guessWord)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement