Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def word(word):
- tries = 6
- output = ['_' for i in range(len(word))]
- blankLeft = len(word)
- while tries > 0:
- tries -= 1
- guessedWord = input('Enter your letter: ')
- if guessedWord == word:
- return print('you won !')
- for i in range(len(word)):
- for letter in guessedWord:
- if word[i] == letter:
- output[i] = letter
- blankLeft -= 1
- if blankLeft <= 0:
- return print("".join(output), '\nyou won !')
- print("".join(output), "\n you have ", tries, " tries left")
- word('try')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement