-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgame.py
More file actions
35 lines (32 loc) · 871 Bytes
/
Copy pathgame.py
File metadata and controls
35 lines (32 loc) · 871 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
word = input('Please enter word: ')
def hangman(word):
wrong = 0
stages = ["",
" _ _ _ _ ",
"| | ",
"| O ",
"| /|\ ",
"| / \ ",
"| you lose "]
rletters = list(word)
board = ['_'] * len(word)
win = False
print('Hello Hall')
while wrong < len(stages) - 1:
print('\n')
char = input('Enter letter: ')
if char in rletters:
cind = rletters.index(char)
board[cind] = char
rletters[cind] = '$'
else:
wrong += 1
print((' '.join(board)))
e = wrong + 1
print('\n'.join(stages[0:e]))
if '_' not in board:
print('WINNER')
print(' '.join(board))
win = True
break
hangman(word)