# Hangman v1.0 by CykoRat # 13/Sep/2014 import random hangman = ( """ ------- | O | """, """ ------- | O /|\ """, """ ------- | O /|\ | """, """ ------- | O /|\ | / """, """ ------- | O /|\ | / \ Game Over """) words = ["networking", "programming", "internet", "python", "cryptography", "ethernet", "cracker", "debugging"] answer = random.choice(words) length_word = len(answer) count = 0 print "Welcome to HangMan" print "You have to guess a word as fast as possible!" print "You have only 5 tries" print guess = raw_input("\nWhat's your guess: ") guess = guess.lower() while guess != answer: if count == 0: print "\n\nWRONG!!" print hangman[0] if count == 1: print "\n\nWRONG!!" print hangman[1] if count == 2: print "\n\nWRONG!!" print "I will give you a hint, length of the word is ", length_word print hangman[2] if count == 3: print "\n\nWRONG!!" print "length of the word is ", length_word print "and it starts with ", answer[0:1] print hangman[3] if count == 4: print "\n\nWRONG!!" print "length of the word is ", length_word print "and it's start with ", answer[0:1] print "alright! this is the last chance, it starts with :", answer[0:1], answer[1:2], answer[2:3], "......................" print hangman[4] if count == 5: print "\n\t\tGAME OVER" print "The correct answer is ", answer break guess = raw_input("\nWhat's your guess: ") guess = guess.lower() count += 1 if guess == answer: print "\nCongratulation, you took only ", count, "tires" print "thanks for playing" raw_input()