# Hangman game

#1

Notice: This is NOT help for "Date and Time," fyi. Sorry about the description.
Anyways, I got some hangman code from a website, and I just wanna know how I could possibly modify this one.

import random

board = [
' +---+ \n | | \n | \n | \n | \n | \n========= \n',
' +---+ \n | | \n 0 | \n | \n | \n | \n========= \n',
' +---+ \n | | \n 0 | \n | | \n | \n | \n========= \n',
' +---+ \n | | \n 0 | \n /| | \n | \n | \n========= \n',
' +---+ \n | | \n 0 | \n /|\ | \n | \n | \n========= \n',
' +---+ \n | | \n 0 | \n /|\ | \n / | \n | \n========= \n',
' +---+ \n | | \n 0 | \n /|\ | \n / \ | \n | \n========= \n'
]

class Hangman:
def init(self,word):
self.word = word
self.missed_letters = []
self.guessed_letters = []

``````def guess(self,letter):
if letter in self.word and letter not in self.guessed_letters:
self.guessed_letters.append(letter)
elif letter not in self.word and letter not in self.missed_letters:
self.missed_letters.append(letter)
else:
return False
return True

def hangman_over(self):
return self.hangman_won() or (len(self.missed_letters) == 6)

def hangman_won(self):
if '_' not in self.hide_word():
return True
return False

def hide_word(self):
rtn = ''
for letter in self.word:
if letter not in self.guessed_letters:
rtn += '_'
else:
rtn += letter
return rtn

def print_game_status(self):
print board[len(self.missed_letters)]
print 'Word: ' + self.hide_word()
print 'Letters Missed: ',
for letter in self.missed_letters:
print letter,
print
print 'Letters Guessed: ',
for letter in self.guessed_letters:
print letter,
print``````

def rand_word():

``````bank = ['thesis','start','thiss','nano','jacks','john']
return bank[random.randint(0,len(bank))]``````

def main():

``````game = Hangman(rand_word())
while not game.hangman_over():
game.print_game_status()
user_input = raw_input('\nEnter a letter: ')
game.guess(user_input)

game.print_game_status()
if game.hangman_won():
print '\nCongratulations! You are the winner of Hangman!'
else:
print '\nSorry, you have lost in the game of Hangman...'
print 'The word was ' + game.word

print '\nGoodbye!\n'``````

if name == "main":
main()

#2

modify it how?
modify it to do what?

#3

You can modify it anyway you like. You have the code, so now you can tweak it to make it suits your needs