import random

n = int(input("Enter the lenght of password: ")) #Ask For The Lenght Of The Password


#consist of all the alphabets, symbols and numbers
letter_upper = ["A","B","C","D","E","F","G","H","I","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
letter_lower = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
number = ["1","2","3","4","5","6","7","8","9","0"]
symbols = ["!","@","#","$","&",]

password = "" #stores the password

#create password by repeating itself according to the lenght of password
for i in range(n):
     password += random.choice(random.choice([letter_upper,letter_lower,number,symbols]))

print(password)

back