I am currently having trouble trying to get my code to continue onto the next line and have my code still work properly.
This is my code as of right now:
Any help would be much appreciated
This is my code as of right now:
Code:
wordChoices = wordChoices = ['ant', 'baboon', 'badger', 'bat', 'bear', 'beaver', 'camel', 'cat', 'clam', 'cobra', 'cougar', 'coyote', 'crow','deer', 'dog', 'donkey', 'duck', 'eagle', 'ferret', 'fox', 'frog', 'goat', 'goose', 'hawk', 'lion', 'lizard', 'llama','mole', 'monkey', 'moose', 'mouse', 'mule', 'newt', 'otter', 'owl', 'panda', 'parrot', 'pigeon', 'python','rabbit', 'ram', 'rat', 'raven', 'rhino', 'salmon', 'seal', 'shark', 'sheep', 'skunk', 'sloth', 'snake', 'spider', 'stork', 'swan','tiger', 'toad', 'trout', 'turkey', 'turtle', 'weasel', 'whale', 'wolf', 'wombat', 'zebra']
word = choice(wordChoices)
wordLen = len(word)
guesses = wordLen * ['_']
maxIncorrect = 6
alphabet= 'abcdefghijklmnopqrstuvxyz'
lettersTried = ''
numberGuesses = 0
lettersCorrect = 0
incorrectGuesses = 0
printGameRules(maxIncorrect, wordLen)
while (incorrectGuesses != maxIncorrect) and (lettersCorrect != wordLen):
letter = getLetter()
if len(letter)==1 and letter.isalpha():
if letters_tried.find(letter) != -1:
print "You already picked", letter
else:
lettersTried = lettersTried + letter
firstIndex = word.find(letter)
if firstIndex == -1:
incorrectGuesses = incorrectGuesses +1
print "The",letter,"is not the mystery word"
else:
print"The",letter,"is in the mystery word"
lettersCorrect = lettersCorrect+1
for i in range(wordLen):
if letter == word[i]:
guesses[i] = letter
else:
print "Please guess a single letter in the alphabet."
hangmanPics(incorrectGuesses)
print ''.join(guesses)
print "Letters tried so far: ", lettersTried
if incorrectGuesses == maxIncorrect:
print "Sorry, too many incorrect guesses. You are hanged."
print "the word was",word
if lettersCorrect == wordLen:
print "You guessed all the letters in the word!"
print "the word was",word
raw_input()
Comment