-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
15223a5
commit 66de32a
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import random | ||
|
||
lower = "abcdefghijklmnopqrstuvwxyz" | ||
upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | ||
numbers ="0123456789" | ||
symbols = "!@#$%^&*()" | ||
|
||
length = 0 | ||
while length < 8 or length > 16: | ||
string = lower + upper + numbers + symbols | ||
length = int(input("How many characters would you like to use? ")) | ||
print ("\n") | ||
if length >= 8 and length <= 16: | ||
password = "".join(random.sample(string,length)) | ||
else: | ||
print ("Choose a number between 8 & 16.") | ||
|
||
|
||
|
||
data = input ("Input the website you would like to generate a password for: ") | ||
print (" ") | ||
print ("You new password is:" + password + "\n") | ||
|
||
try: | ||
f=open('master.txt','a') | ||
f.write(data) | ||
f.write(" ") | ||
f.write(password) | ||
f.write("\n") | ||
except Exception as e: | ||
print ("Error:", str(e)) | ||
finally: | ||
|
||
f.close() |