Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions Hangman.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

#constants
import random
#Creating a tuple for the hangman graphic
Expand Down Expand Up @@ -104,22 +105,22 @@
used = [] #list of letters already guessed


print "Welcome to hangman! Good luck"
print("Welcome to hangman! Good luck")

while wrong < MAX_WRONG and so_far != word:
print HANGMAN[wrong]
print "You've used the following letters: \n", used
print "The word so far guessed is : ", so_far
print(HANGMAN[wrong])
print("You've used the following letters: \n", used)
print("The word so far guessed is : ", so_far)

guess = raw_input("Enter your guess: ")
guess = input("Enter your guess: ")
guess = guess.upper()
used.append(guess)



#Checking the guess
if guess in word:
print "\nYes! ", guess, " is in the word!"
print("\nYes! ", guess, " is in the word!")
#create a new so_far to append guess
new = ""
for i in range(len(word)):
Expand All @@ -129,16 +130,16 @@
new += so_far[i]
so_far = new
else:
print"\nSorry! The ", guess, " isn't in the word."
print("\nSorry! The ", guess, " isn't in the word.")
wrong += 1

if wrong == MAX_WRONG:
print HANGMAN[wrong]
print "You know nothing Jon Snow!"
print(HANGMAN[wrong])
print("You know nothing Jon Snow!")

else:
print "Lord Tyrion, you know everything!"
print "The word was ", word, "and it's meaning is 'still to come'"
print("Lord Tyrion, you know everything!")
print("The word was ", word, "and it's meaning is 'still to come'")


raw_input("Press enter to exit")
input("Press enter to exit")