-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython code.py
More file actions
33 lines (30 loc) · 797 Bytes
/
python code.py
File metadata and controls
33 lines (30 loc) · 797 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
our_word=input("Player 1 enter you guessing word in caps:")
guess=7
name=input("player 2 enter your name:")
print("Hello",name,"welcome to hangman game!!!")
print("lets start playing!!")
print("Your number of letter's is:")
ls=['_']*len(our_word)
print(ls)
while guess>0:
g=input("give you guess:")
j=''
if g in our_word:
l=0
for j in our_word:
if j==g:
ls[l]=g
print("Your guess is correct")
l=l+1
else:
guess=guess-1
print("your guess is wrong")
print("You have",guess,"guesses remaining")
print(ls)
if ls==list(our_word):
break
if ls==list(our_word):
print("yay!! You have won")
else:
print("Better luck next time")
print("The answer is",our_word)