diff --git a/Hangman.py b/Hangman.py index c1a27c1..b51a4f7 100644 --- a/Hangman.py +++ b/Hangman.py @@ -1,5 +1,62 @@ import random +stages = [''' + +---+ + | | + O | + /|\ | + / \ | + | +========= +''', ''' + +---+ + | | + O | + /|\ | + / | + | +========= +''', ''' + +---+ + | | + O | + /|\ | + | + | +========= +''', ''' + +---+ + | | + O | + /| | + | + | +=========''', ''' + +---+ + | | + O | + | | + | + | +========= +''', ''' + +---+ + | | + O | + | + | + | +========= +''', ''' + +---+ + | | + | + | + | + | +========= +'''] + # Create a List word_list = ["aardvark", "baboon", "camel"] @@ -11,6 +68,9 @@ # Creating an empty list display = [] +# Create a variable to use for number of lives +lives = 6 + # Printing out the guess word print(f"Psst, the guess word is:", chosen_word) @@ -20,6 +80,11 @@ display.append("_") # print(display) +# for name in chosen_word: +# if guess not in name: +# lives -= 1 +# print(lives) + while True: # Print out the Guess Letter @@ -36,15 +101,28 @@ for check in range(len(chosen_word)): if guess in chosen_word[check]: display[check] = guess + # Check if guess is not in the chosen word + if guess not in chosen_word: + lives -= 1 + # Check for no lives and exit the loop + if lives == 0: + print(f"You Loose!, you now have {lives} lives left") + break + # for name in range(lives): + # if guess not in chosen_word: + # lives -= 1 + print(lives) print(display) + # create a counter list to use to verify the display list if no more item left counter = [] + # For loop use for looping through display list for count in display: if count in chosen_word: counter += count - + # comparing and validating the counter list against the display to make sure no more blank space is left if counter == display: print("You Won!") break