File tree 1 file changed +31
-0
lines changed 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ import string
2
+ import random
3
+
4
+ print ("Welcone to Password Generator\n " )
5
+
6
+ forwhat = input ("Enter the website or application for which you want to generate password:\n " )
7
+ length = int (input ("Enter the length of password(Max-94)\n " ))
8
+ if length >= 94 :
9
+ print ("Max length crossed." )
10
+ quit ()
11
+
12
+ s1 = list (string .ascii_lowercase )
13
+ s2 = list (string .ascii_uppercase )
14
+ s3 = list (string .digits )
15
+ s4 = list (string .punctuation )
16
+
17
+ elements = s1 + s2 + s3 + s4
18
+
19
+ random .shuffle (elements )
20
+
21
+ password = "" .join (elements [0 :length ])
22
+
23
+ print ("The safe generated password is :" ,password ,"\n " )
24
+
25
+ saveyn = input ("Do you want save the password?\n Enter Yes or No\n " )
26
+
27
+ if saveyn == "Yes" :
28
+ f = open ("generatedpasswords.txt" ,"a" )
29
+ f .write (forwhat + " - " + password + "\n " )
30
+ f .close ()
31
+ print ("Your password is succesfully saved in 'generatedpasswords.txt' file." )
You can’t perform that action at this time.
0 commit comments