input: Write a function to generate a random password of length 8, which consists of alphanumeric characters and at least one special character. The function should ensure that the generated password contains at least one special character and return the password.
  assert generate_password()!=''
  assert len(generate_password())==8
  assert any([char in string.punctuation for char in generate_password()])==True
output: import random
  import string
  
  def generate_password():
      special_char = random.choice(string.punctuation)
      alphanumeric = ''.join(random.choices(string.ascii_letters + string.digits, k=7))
      password = alphanumeric + special_char
      return ''.join(random.sample(password, len(password)))