Skip to content

Commit 1a38102

Browse files
authored
Add files via upload
1 parent 15af477 commit 1a38102

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# A simple program that helps users to get a password idea.
2+
import random
3+
import string
4+
5+
def Storage():
6+
characters = list(string.ascii_letters + string.digits + '!@#$%^&*()')
7+
8+
options = ['y', 'n']
9+
10+
return characters, options
11+
12+
def get_password(characters, options):
13+
14+
while True:
15+
user_choice = input('Do you want to generate a new password (y/n): ').lower()
16+
17+
if user_choice not in options:
18+
print('Enter a valid choice (y/n)')
19+
20+
21+
else:
22+
if user_choice == 'y':
23+
password_length = int(input('Enter password length: '))
24+
random.shuffle(characters)
25+
26+
password = []
27+
28+
for x in range(password_length):
29+
password.append(random.choice(characters))
30+
31+
random.shuffle(password)
32+
33+
password = ''.join(password)
34+
35+
print(password)
36+
37+
else:
38+
print('Thanks for using this program...😁')
39+
break
40+
41+
def Main():
42+
characters, options = Storage()
43+
44+
get_password(characters, options)
45+
46+
Main()
47+
48+

0 commit comments

Comments
 (0)