input: Written a function to generate a random password with a minimum length of 8 characters, ensuring it contains at least one number and one special character. The generated password should then be printed.
  
  import string
  import random
  
  def generate_password():
   length = 8
   chars = string.ascii_letters + string.digits + string.punctuation
   while True:
    password = "".join(random.choice(chars) for i in range(length))
    if any(char.isdigit() for char in password) and any(char in string.punctuation for char in password):
     break
   
   return password
  
  assert len(generate_password()) >= 8
  assert any(char.isdigit() for char in generate_password())
  assert any(char in string.punctuation for char in generate_password())
  
  password = generate_password()
  print(password)
output:     
  def generate_password():
   length = 8
   chars = string.ascii_letters + string.digits + string.punctuation
   while True:
    password = "".join(random.choice(chars) for i in range(length))
    if any(char.isdigit() for char in password) and any(char in string.punctuation for char in password):
     break
   
   return password
  