-
Notifications
You must be signed in to change notification settings - Fork 0
/
PasswordGen.py
32 lines (24 loc) · 987 Bytes
/
PasswordGen.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
'''
Random Password Generator using Python
Author: Aman Nayyar
'''
# import the necessary modules!
import random
import string
print('hello, Welcome to Password generator!') # greet the user
# input the length of password
length = int(input('\nEnter the length of password: '))
# define data using string module
lower = string.ascii_lowercase # using the ascii to store the upper and lowercase alphabet
upper = string.ascii_uppercase
num = string.digits # the numbers
symbols = string.punctuation # for special characters which is important
# string.ascii_letters
# combine the data to make the strong password
all = lower + upper + num + symbols
# use random to make the password with evrything and the length which comes with user input
temp = random.sample(all,length)
# create the password by using the temp variable
password = "".join(temp)
# print the password
print(password)