Skip to content

Instantly share code, notes, and snippets.

@himan94
Created January 31, 2017 17:54
Show Gist options
  • Save himan94/d692a31e203c678a827775588c9f1ae7 to your computer and use it in GitHub Desktop.
Save himan94/d692a31e203c678a827775588c9f1ae7 to your computer and use it in GitHub Desktop.
code to create a hangman game with 7 chances (
h = "namaste"
w = []
s = len(h)
w.append(["O"] * s)
count = 0
count1 = 0
while (count < 7):
print w
if count1 == s :
print"you win"
break
d = raw_input("enter a letter:")
t = d
for i,j in enumerate(h):
if d == j:
print"hit"
print i
w[0][i] = t
count = count - 1
count1 = count1 + 1
count = count + 1
@himan94
Copy link
Author

himan94 commented Jan 31, 2017

1 problem is that the code does not work properly if h(input) has spaces in between words ex- star wars
any help is really apreciated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment