Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- import time
- import collections
- def pics():
- if count == 0:
- print (" _________ ")
- print ("| | ")
- print ("| 0 ")
- print ("| /| ")
- print ("| / ")
- print ("| ")
- print ("| ")
- elif count == 1:
- print (" _________ ")
- print ("| | ")
- print ("| 0 ")
- print ("| /| ")
- print ("| / ")
- print ("| ")
- print ("| ")
- elif count == 2:
- print (" _________ ")
- print ("| | ")
- print ("| 0 ")
- print ("| /| ")
- print ("| ")
- print ("| ")
- print ("| ")
- elif count == 3:
- print (" _________ ")
- print ("| | ")
- print ("| 0 ")
- print ("| /| ")
- print ("| ")
- print ("| ")
- print ("| ")
- elif count == 4:
- print (" _________ ")
- print ("| | ")
- print ("| 0 ")
- print ("| | ")
- print ("| ")
- print ("| ")
- print ("| ")
- elif count == 5:
- print (" _________ ")
- print ("| | ")
- print ("| GAME OVER ")
- print ("| YOU LOSE ")
- print ("| ")
- print ("| ")
- print ("| (**)--- ")
- print("Welcome to HANGMAN nHave Fun =)")
- print("You can only get 5 wrong. You will lose your :n1. Right Legn2.Left Legn3.Right Armn4.Left Armn5.YOUR HEAD... YOUR DEAD")
- print("")
- time.sleep(2)
- words = "ferret".split()
- word = random.choice(words)
- w = 0
- g = 0
- count = 0
- correct = []
- wrong = []
- for i in range(len(word)):
- correct.append('#')
- wrdsplit = list(word)
- while count < 5 :
- pics()
- print("")
- print("CORRECT LETTERS : ",''.join(correct))
- print("WRONG LETTERS : ",wrong)
- print("")
- print("Please input a letter")
- guess = input("> ")
- if guess in wrdsplit:
- for count in range(len(wrdsplit)):
- x = wrdsplit.index(guess)
- wrdsplit[x] = '&'
- correct[x] = guess
- g = g + 1
- wrdsplit[x] = '&'
- if "".join(correct) == word:
- print("Well done... You guessed the word in", g ,"guesses and you got", w , "wrong")
- print("YOU LIVED")
- break
- elif guess not in wrdsplit:
- wrong.append(guess)
- w = w + 1
- g = g + 1
- count = count +1
- pics()
- print("The correct word was : ",word)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement