-
Notifications
You must be signed in to change notification settings - Fork 0
/
Hangman.py
127 lines (120 loc) · 2.27 KB
/
Hangman.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
import random
stages = ['''
+---+
| |
😵 |
/|\ |
/ \ |
|
=========
''', '''
+---+
| |
😵 |
/|\ |
/ |
|
=========
''', '''
+---+
| |
😵 |
/|\ |
|
|
=========
''', '''
+---+
| |
😵 |
/| |
|
|
=========''', '''
+---+
| |
😵 |
| |
|
|
=========
''', '''
+---+
| |
😵 |
|
|
|
=========
''', '''
+---+
| |
|
|
|
|
=========
''']
logo = '''
_
| |
| |__ __ _ _ __ __ _ _ __ ___ __ _ _ __
| '_ \ / _` | '_ \ / _` | '_ ` _ \ / _` | '_ \
| | | | (_| | | | | (_| | | | | | | (_| | | | |
|_| |_|\__,_|_| |_|\__, |_| |_| |_|\__,_|_| |_|
__/ |
|___/ '''
print(logo)
print("WELCOME TO theHANGMAN!!! 😵")
z = 0
wordlist = ["l a n c e l o t", "c z e c h s l o v a k i a", "a l p h o n s o", "b o u l e v a r d", "z e p h y r u s",
"f l o c c i n a u c i n i h i l i p i l i f i c a t i o n"]
n = 5
A = ''
while True:
random.shuffle(wordlist)
a = wordlist[0]
c = a.split()
b = a.split()
for i in range(n):
n2 = random.randint(0, 4)
b[n2] = '_'
for i in range(len(b)):
print(b[i], end="")
break
print("\nThe word you have to find>>>")
print(A)
print("Please guess the letters from left to right")
while True:
x = b.index('_')
c1 = input("\nPlease enter your letter: ")
if z == 6:
print("You have ", 6 - z, " chances left!")
print(stages[0])
print("THE GUY IS DEAD")
break
else:
pass
if c1 == c[x]:
x = b.index('_')
print("Perfecto!!!")
b[x] = c1
for i in range(len(b)):
print(b[i], end="")
if b == c:
print("\nYou WIN")
print("The guy Lives")
break
else:
pass
else:
z += 1
if z == 6:
print("You have ", 6 - z, " chances left!")
print(stages[0])
print("THE GUY IS DEAD")
break
print("Nah!")
print("You have ", 6 - z, " chances left!")
print(stages[6 - z])
pass