Untitled

 avatar
unknown
plain_text
2 years ago
3.1 kB
4
Indexable
print("Welcome to - ")

HANGMAN_LOGO = print(    "   _   _\n"
                         "  | | | |\n" 
                         "  | |_| |\n" 
                         "  |     | __ _ _ __   __ _ _ __ ___   __ _ _ __\n" 
                         "  |  _  |/ _  |  _  \/ _  |  _   _  \/ _  |  _ \/\n"  
                         "  | | | | { | | | | | { | | | | | | | { | | | | |\n" 
                         "  |_| |_|\__,_|_| |_|\__, |_| |_| |_|\__,_|_| |_|\n" 
                         "                      __/ |\n" 
                         "                     |___/\n" 
)
print("""   -------
     |    |
     O    |
   / | \  |
     |    |
    / \   | 
_____        \n\n """)

#_____________________________________________________________________________________________________________________________#

num_of_tries_for_loop = "iiiiii" # def number of tries#
num_of_tries = 6
#_____________________________________________________________________________________________________________________________#

print("You have " + str(num_of_tries) + " tries") # opening screen #
print("\n")
name = input("Please enter your name: ")
print("Hello", name)
print("\n\n")
secret_word = input("Please enter a word: ")
#_____________________________________________________________________________________________________________________________#

index = "_ "
word = print(str(index) * len(secret_word)) # word underscore for letter#
print("\n")
#_____________________________________________________________________________________________________________________________#

x = 0 # def the number for the printing of the pictures#
y = 0
num_of_fails = 0
 #_____________________________________________________________________________________________________________________________#
 
def check_in_word(): # def a function for checking the letter#
	global x
	secret_letter = input("Gusse a letter: ")
	if (secret_letter in secret_word):
		print("true")
		print(HANGMAN_PHOTOS[x])
	elif (secret_letter not in secret_word):
		x = x + 1
		print("fales")
		print(HANGMAN_PHOTOS[x])
		num_of_tries_for_loop.replace(num_of_tries_for_loop[0],"")
#_____________________________________________________________________________________________________________________________#

HANGMAN_PHOTOS = { #the hangman pictures#
  0: """
x-------x
|
|
|
|
|_____""",
  1: """
x-------x
|       |
|
|
|
|_____""",
  2: """
x-------x
|       |
|       0
|
|
|_____""",
  3: """
x-------x
|       |
|       0
|       |
|
|_____""",
  4: """
x-------x
|       |
|       0
|      /|\ 
|
|_____""",
  5: """
x-------x
|       |
|       0
|      /|\ 
|      /
|_____""",
  6: """
x-------x
|       |
|       0
|      /|\ 
|      / \ 
|_____"""
}
#_____________________________________________________________________________________________________________________________#

num_of_tries_left = len(num_of_tries_for_loop)

for i in num_of_tries_for_loop: #the loop to run it 6 times#
	check_in_word()

Editor is loading...