Friday, February 28, 2020

Police mug shot sketch in Python

def hat():
  print("  -------")
  print("  |     |")
  print(" ---------");

def bald():
  print("")
  print("  .......")
  print("  .     .")

def spiky():
  print("")
  print(" \\|||||||/")
  print("  |     |")

def wideEyed():
  print(" (| O O |)")

def spectacled():
  print(" (|-0-0-|)")

def smallEyed():
  print(" (| . . |)")

def largeNose():
  print("  | /_\\ |")

def pugNose():
  print("  |  ^  |")

def mediumNose():
  print("  |  >  |")

def smiling():
  print("  |\\___/|")
  print("   -----")

def frowning():
  print("  |/---\\|")
  print("   -----")

def bearded():
  print("  |||-|||")
  print("   |||||")
  print("    |||")

while True:
  print("Choices for HAIR  type: 1. Hat     2. Bald       3. Spiky")
  print("Choices for EYE   type: 1. Wide    2. Spectacled 3. Small")
  print("Choices for NOSE  type: 1. Large   2. Pug        3. Medium")
  print("Choices for MOUTH type: 1. Smiling 2. Frowning   3. Bearded")
  features = int(input("Enter your choices: "))
  print()

  mouth = features % 10;
  nose = (features // 10) % 10;
  eye = (features // 100) % 10;
  hair = (features // 1000) % 10;
  
  if hair == 1:
    hat()
  elif hair == 2:
    bald()
  elif hair == 3:
    spiky()

  if eye == 1:
    wideEyed();
  elif eye == 2:
    spectacled()
  elif eye == 3:
    smallEyed()

  if nose == 1:
    largeNose()
  elif nose == 2:
    pugNose()
  elif nose == 3:
    mediumNose()

  if mouth == 1:
    smiling()
  elif mouth == 2:
    frowning()
  elif mouth == 3:
    bearded()

No comments:

Post a Comment