I'm trying to use an already set global variable inside a function, but keep getting an error "Local variable "password" referenced before assigned". Is there something I'm missing to where it can't find the actual global variable?
password = ""
def random_characters(letters):
add = random.choice(letters)
password = password + add
letters_strong = string.ascii_letters + string.digits + string.punctuation
for i in range(16):
random_characters(letters_strong)
print(password)