input: Write a function to generate a random password of length 8 characters, which contains at least one of each character type (lowercase, uppercase, digits, special characters). The function should return the generated password as a string.
  assert generate_password()=="A1b!cd23"
  assert generate_password()=="Z0p@dEfg"
  assert generate_password()=="X4Y^h5i6"
  assert generate_password()=="L$7m8N%o"
  assert generate_password()=="Q9R&StuV"
output: import random
  import string
  
  def generate_password():
      lowercase = random.choice(string.ascii_lowercase)
      uppercase = random.choice(string.ascii_uppercase)
      digit = random.choice(string.digits)
      special = random.choice(string.punctuation)
      remaining = ''.join(random.choices(string.ascii_letters + string.digits + string.punctuation, k=4))
      password = lowercase + uppercase + digit + special + remaining
      return ''.join(random.sample(password, len(password)))