password generator returns empty password list after using join and for-loop
import random
import string
def generate_random_password():
characters = list(string.ascii_letters + string.digits + "!@#$%^&*()")
length = int(input("Enter password length: "))
password = []
length = len(password)
random.shuffle(characters)
for characters in range(length):
"".join(characters)
password.append(characters)
print(password)
generate_random_password()
lengthvariable is being set to zero withlength = len(password)"".jointo do anything with it, andcharactersis just an integer, not a character, in the body of the loop. In short, virtually nothing about the code after the call torandom.shuffleis useful.