Lesson 11: Functions - Drawing Hangman

posted Jan 12, 2018, 7:57 AM by Attila Lengyel
def drawhangman(missedGuesses):
  if missedGuesses <= 0: return
  print("     _____________")
  if missedGuesses > 1:
    print("      |          |")
  else: print("      |")
  if missedGuesses > 2:
    print("      |          O")
  else: print("      |")
  if missedGuesses > 3:
    print("      |         /|\\")
  else: print("      |")
  if missedGuesses > 4:
    print("      |          |")
  else: print("      |")
  if missedGuesses > 5 :
    print("      |         / \\")
  else: print("      |")
  print("      |")
  print("      |")
  print("      |_____________")

for x in range(0,7): drawhangman(x)







Comments