forked from INDHU-P/Basic_python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpasswordgenerator.py
More file actions
72 lines (62 loc) · 1.77 KB
/
passwordgenerator.py
File metadata and controls
72 lines (62 loc) · 1.77 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
"""
Generate a password of 10 characters with letters symbols and numbers
choose an option to opt out or include caps, symbols, numbers
"""
import random
import string
def allFun():
chars = string.ascii_uppercase + string.ascii_lowercase + '!@#$%^&*?'
password = ''
for c in range(10):
password += random.choice(chars)
print(password)
def Num():
chars = string.ascii_lowercase + '1234567890'
password = ''
for c in range(10):
password += random.choice(chars)
print(password)
def sym():
chars = string.ascii_lowercase + '!@#$%^&*?'
password = ''
for c in range(10):
password += random.choice(chars)
print(password)
def letters():
chars = string.ascii_lowercase + string.ascii_uppercase
password = ''
for c in range(10):
password += random.choice(chars)
print(password)
def numSymb():
chars = '1234567890!@#$%^&*?'
password = ''
for c in range(10):
password+=random.choice(chars)
print(password)
def capsSymb():
chars = string.ascii_uppercase + '!@#$%^&*?'
password = ''
for c in range(10):
password +=random.choice(chars)
print(password)
def capsNum():
chars = string.ascii_uppercase + '1234567890'
password = ''
for c in range(10):
password+=random.choice(chars)
print(password)
def generate():
usr_inpC = input("Generate with caps? (y/n): ")
usr_inpSymb = input("Generate pwd with sumbols? (y/n): ")
user_inpNum = input("Generate pwd with numbers? (y/n): ")
if (usr_inpC == "y" and usr_inpSymb == "y" and user_inpNum == "y"):
allFun()
elif (usr_inpC == "y" and usr_inpSymb == "y" and user_inpNum == "n"):
capsSymb()
elif (usr_inpC == "y" and user_inpNum == "y" and usr_inpSymb == "n"):
capsNum()
elif (usr_inpC == "n" and usr_inpSymb == "y" and user_inpNum == "y"):
numSymb()
else:
print("please enter the combination of any two option")