input: Write a function to generate a random password with a length of 8 characters that includes at least one uppercase letter, one lowercase letter, one digit, and one special character.
  
  def generate_password():
     up_alphabet = string.ascii_uppercase
     low_alphabet = string.ascii_lowercase
     digits = string.digits
     symbols = string.punctuation
     length = 8
     pass_characters = up_alphabet + low_alphabet + digits + symbols
     password =  ''.join(random.sample(pass_characters, length))
     return password
output: def generate_password():
      import random
      import string
      up_alphabet = string.ascii_uppercase
      low_alphabet = string.ascii_lowercase
      digits = string.digits
      symbols = string.punctuation
      while True:
          password = ''.join(random.sample(up_alphabet + low_alphabet + digits + symbols, 8))
          if (any(c.isupper() for c in password) and
              any(c.islower() for c in password) and
              any(c.isdigit() for c in password) and
              any(c in symbols for c in password)):
              return password