input: Write a function to generate a password that meets certain criteria (includes at least one number, one lowercase letter, one uppercase letter, and one special character) and has a length of 8 characters.
  assert len(generate_password()) == 8
  assert has_number(generate_password()) == True
  assert has_lowercase(generate_password()) == True
  assert has_uppercase(generate_password()) == True
  assert has_special_char(generate_password()) == True
output: import random
  import string
  
  def generate_password():
      characters = [
          random.choice(string.digits),
          random.choice(string.ascii_lowercase),
          random.choice(string.ascii_uppercase),
          random.choice(string.punctuation)
      ]
      characters += random.choices(string.ascii_letters + string.digits + string.punctuation, k=4)
      random.shuffle(characters)
      return ''.join(characters)