Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- a = input("Choose a difficulty \n \
- Easy-10 Lives \n \
- Medium-7 Lives \n \
- Hard-5 Lives \n \
- Choose a difficulty: ")
- a = a.lower()
- if a in {"easy", "medium", "hard"}:
- print("Difficulty Selected")
- else:
- print("Invalid Input!")
- if a == 'easy':
- print("You have 10 lives left.")
- lives = 10
- if a == 'medium':
- print("You have 7 lives left.")
- lives = 7
- if a == 'hard':
- print("You have 5 lives left.")
- lives = 5
- words = ['fairy', 'birds', 'doggy', 'frogs', 'phone', 'green', 'hello', ] #Dont put your nose where it doesnt belong
- secretword = random.choice(words)
- clue = list('?????')
- heart = u'\u2764'
- guess_correctly = False
- def update_clue(guessed_letter, secretword, clue):
- index = 0
- while index < len(secretword):
- if guessed_letter == secretword[index]:
- clue[index] = guessed_letter
- index = index + 1
- while lives > 0:
- print(clue)
- print('Lives Left: ' + heart * lives)
- guess = input('Guess a letter of the entire phrase!: ')
- if guess == secretword:
- guess_correctly = True
- break
- if guess in secretword:
- update_clue(guess, secretword, clue)
- else:
- print('Incorrect! You lost a life!')
- lives = lives - 1
- if guess_correctly == True:
- print('You Won! The secret word was ' + secretword)
- else:
- print('You lost! The secret word was ' + secretword)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement