Hello i just started learning about python and am beginning a hangman program. I'm trying to read the word from the document then output _ for each letter in it. so far it runs but outputs nothing I'm not sure if I'm formatting it incorrectly or am forgetting something any help would be appreciated.
Thank you,
Acoxia
import string
import linecache
import random
def find(strng, ch):
index = 0
while index < len(strng):
if strng[index] == ch:
return index
index += 1
return -1
def guessword(word):
infile = open('words.txt', 'r')
n =random.random(0,100)
linecache.getline(infile, n)
g = len(word)
y = 0
i=0
while y != g:
dashes += " _"
y += 1
while i < 6 and find(word, '_') != -1:
print dashes