After running, and choosing password strength, there is nothing stored in "password". Also, is there a way to avoid making 5 if loops for each password_strength level?
import string
import random
def password_generator() :
password_strength = [1,2,3,4,5]
password = []
user_choice = input("Enter desired password strength (1-5) : ")
if user_choice == password_strength[0] :
password_length = 4
for i in range(0, password_length) :
password.append(chr(random.randint(33,126)))
print(password)
password_generator()