Skip to content

Commit 19adcd5

Browse files
Create hangman.py
1 parent 1cb0407 commit 19adcd5

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

hangman.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import random
2+
3+
#Create Welcome message Ask player A to enter a word
4+
hangman_display = ["",
5+
" _______________ " ,
6+
" | | " ,
7+
" | | " ,
8+
" | O " ,
9+
" | \ | / " ,
10+
" | \|/ " ,
11+
" | | " ,
12+
" | | " ,
13+
" | / \ " ,
14+
" | / \ " ,
15+
" | " ,
16+
" | " ,
17+
" | " ,
18+
"_______|_________________________ "
19+
]
20+
21+
print("\n".join(hangman_display[0 : len(hangman_display)]))
22+
print("\n")
23+
print("Welcome to Hangman Game!!!")
24+
25+
secret_word_clue = {
26+
"Taylor Swift", "Famous Female Pop Singer",
27+
"Java", "Number one programming language",
28+
"Albert Einstein", "A famous American Scientist",
29+
"Barack Obama", "A well known American President",
30+
"The White House", "A famous building in Washington DC"
31+
}
32+
33+
rand = random.randint(0, len(secret_word_clue) + 1)
34+
35+
36+
#If player B guesses correct letter, fill in the letter at that position
37+
38+
#If player A guesses wrong letter, start building hangman
39+
40+
#If the hangman is complete, player A wins
41+
42+
#Player B wins, if word guessed correctly before the hangman formed
43+

0 commit comments

Comments
 (0)