Question: ometimes you have to fix others bad programs. Get this program to successfully run. You can modify it any way you need to so it
ometimes you have to fix others bad programs. Get this program to successfully run. You can modify it any way you need to so it will run. The core concept has to stay the same though for this program. It needs to be a hangman game.
Bonus points if you put a actual stick figure into the program while its running.
word_bank = ["jump", "run", "dive", "care", "smoke", "pipe", "left", "right", "hand", "finger", "bone", "pink", "peach"] from random import randint scoreboard = [] def generate_word(words): return list(words[randint(0,12)]) word = generate_word(word_bank) for letter in word: scoreboard.append('__') print "Try to guess this word: " print " ".join(scoreboard) print word count = 5 print str(count) + " misses left." for guess in range(50): guess = raw_input("Guess a letter: ") if guess not in word: count = count - 1 print str(count) + " misses left." if count == 0: print "You lose! The word is " + "".join(word) + "." break else: continue else: index = word.index(guess) scoreboard[index] = guess print " ".join(scoreboard) if scoreboard == word: print "You win!" break
Python!!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
