Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- name = input ("Please enter your name ")
- print ("➤ Welcome", name,"let's play!")
- done = False
- while not done:
- words =[]
- yes = "Y", "y", "Yes", "yes", "Yes", "Yep", "yep", "YEP", "Yeah", "yeah", "YEAH"
- no = "N", "n", "No", "no", "NO", "Nope", "nope", "NOPE", "nah", "Nah", "NAH"
- addWords = input ("Would you like to add your own words? Y/N: ")
- if addWords in yes:
- end = False
- while end == False:
- new = input("★ Enter new word ")
- words.append(new)
- more = input("✰ Add more words? Y/N: ")
- if more in no:
- end = True
- elif more in yes:
- end - False
- #game start
- else:
- addWords in no
- words =["python","elephant","orange","pizza","promgramming","monkey","fingers","horse","england","america","burger"]
- random = random.choice(words)
- guesses = ''
- lives = 5
- while lives > 0:
- lostLifes = 0
- for letter in random:
- if letter in guesses:
- print(letter,)
- else:
- print ('_',)
- lostLifes = (lostLifes+1)
- print
- if lostLifes == 0:
- print ("Congratulations", name)
- print (" ✔ You Won! ✔")
- break
- newLetter = False
- while newLetter == False:
- guess = input ("Guess a letter: ")
- if len(guess) > 1:
- print ("★ You may only guess one letter!")
- guess = input ("Guess a letter: ")
- if guess in guesses:
- print("✰ You already guessed that letter")
- else:
- guesses += guess
- newLetter = True
- if guess not in random:
- lives = (lives -1)
- print ("✖ Lost a life")
- print ("Only", lives, "lives left.")
- print ("➤ Used letters:", guesses,)
- if lives == 0:
- print (" ✖ YOU LOST! ✖")
- print ("The answer was", random)
- input = done("➤ Try again? Y/N: ")
- if input in no:
- done = True
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement