File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed
Python_Begginer_Projects/Easy Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change
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
+
You can’t perform that action at this time.
0 commit comments