input: Write a function to generate a random password with a minimum length of 8 characters and it should contain at least one number and one special character. If successful, return the generated password as a string.
  assert generate_password().isalnum()==False
  assert len(generate_password())>=8
  assert any(char in generate_password() for char in string.digits)==True
  assert any(char in generate_password() for char in string.punctuation)==True
output: import random
  import string
  
  def generate_password():
      length = random.randint(8, 12)
      chars = string.ascii_letters + string.digits + string.punctuation
      while True:
          password = ''.join(random.choice(chars) for _ in range(length))
          if any(char in string.digits for char in password) and any(char in string.punctuation for char in password):
              return password