We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents ac37368 + 0db710e commit 4e3d987Copy full SHA for 4e3d987
hangman.py
@@ -0,0 +1,29 @@
1
+import random
2
+guess_list = [
3
+'samuel',
4
+'activity',
5
+'banana',
6
+'school',
7
+'python',
8
+'programming',
9
+'hangman',
10
+]
11
+
12
+print('WELCOME TO MY HANGMAN GAME\n')
13
+cc = random.choice(guess_list).upper()
14
+guesses = len(cc)+4
15
+repw = ['_' for i in range(len(cc))]
16
+while guesses > 0:
17
+ print(f'WORD: {" ".join(repw)}')
18
+ ug = input('Guess a letter:').upper()
19
+ for char in range(len(cc)):
20
+ if ug==cc[char]:
21
+ repw[char]=ug
22
+ if repw.count('_')==0:
23
24
+ break
25
+ print('Tries remain:',guesses-1,'\n')
26
+ guesses-=1
27
28
29
+print('\nYou WIN🎉\n') if repw.count('_')==0 else print('\nYou LOSE💔')
0 commit comments