input: Write a function to generate a random password of length 8, containing 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
  
  print(generate_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.choice(up_alphabet + low_alphabet + digits + symbols) for _ in range(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