Professional Documents
Culture Documents
connector
import random # for choosing random elements for the password
import array # This module defines an object type which can compactly
represent an arrayof
cnx = mysql.connector.connect(user='root',
password='ayaan6398',
host='3306',
database='users')
a=input('user id for which you want the password:')
pass_len = int(input('length of password:')) # length of password you want
digits = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'] # all digits
lower_case = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j','k', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
'x', 'y', 'z'] # all lowercase letters
upper_case = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J','K', 'M',
'N', 'O', 'p', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z'] # all uppercase letters
symbols = ['*','(', ')', '<' ':', '?', '.', '/', '|', '~', '>', '@', '#',
'$', '%', '=', ] # all symbols
random_dig = random.choice(digits)
random_low = random.choice(lower_case)
randome_upp = random.choice(upper_case)
randome_sym = random.choice(symbols)
# use random to chose random elements from the the lists
main_pass = ''
for z in temp_pass: # to creat the final password
main_pass = main_pass + z
b=main_pass
a='your password for the ID:',a,'is',':',b
print(a)
c=input("Do you want to search your password again(Y/N):")
if c=='y':
print(b)
if c=='Y':
print(b)
else:
print("Have a Good day")