input: Write a function to generate a random password with a minimum length of 8 characters, containing at least one number and one special character. The function should return the generated password.
  assert generate_password()==True
  assert generate_password()==True
  assert generate_password()==True
  assert generate_password()==True
  assert generate_password()==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(c.isdigit() for c in password) and any(c in string.punctuation for c in password):
              return password