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