Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
atilsamancioglu authored Dec 31, 2018
1 parent 6dffd4e commit c2bcf52
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions 20-Hangman.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name = input("Name: ")
print("Hello " + name + " time to play hangman!")

secret_word = "Metallica"

guesses = ""

lives = 10

while lives > 0:

character_left = 0

for character in secret_word:

if character in guesses:

print(character)
else:
print("-")
character_left += 1

if character_left == 0:
print("You won!!!")
break


guess = input("Guess a word: ")
guesses += guess

if guess not in secret_word:
lives -= 1
print("Wrong!")
print(f"You have {lives} left")

if lives == 0:
print("You died!")

0 comments on commit c2bcf52

Please sign in to comment.