-
Notifications
You must be signed in to change notification settings - Fork 0
/
Виселица.py
38 lines (37 loc) · 1.18 KB
/
Виселица.py
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
36
37
38
def vis(word):
wrong = 0
stages = ["",
"________ ",
"| ",
"| | ",
"| 0 ",
"| /|\ ",
"| / \ ",
"| "
]
letter = list(word)
board = ['_'] * len(word)
win = False
print('Добро пожаловать на казнь!')
while wrong < len(stages) - 1:
print('\n')
msg = 'Введите букву: '
quess = input(msg)
if quess in letter:
cind = letter.index(quess)
board[cind] = quess
letter[cind] = '$'
else:
wrong += 1
print(''.join(board))
a = wrong + 1
print('\n'.join(stages[0:a]))
if '_' not in board:
print('Вы выиграли! Было загадано слово: ')
print(' '.join(board))
win = True
break
if not win:
print('\n'.join(stages[0: wrong]))
print('Вы проиграли! Было загадано слово: {}'.format(word))
vis('номер')