Created
November 10, 2024 08:48
-
-
Save ufuayk/b80ee074d8769b5441da7ce9a9ce6389 to your computer and use it in GitHub Desktop.
A Strong Password Generation Tool
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
import string, random | |
print("Password Generator") | |
passwd_length = int(input("Length: ")) | |
print(" ") | |
print('''Security Preferences: | |
1. Number | |
2. Letter | |
3. Special Character | |
4. Save and Exit''') | |
print(" ") | |
charList = "" | |
while(True): | |
choice = int(input(">>> ")) | |
if(choice == 1): | |
charList += string.ascii_letters | |
elif(choice == 2): | |
charList += string.digits | |
elif(choice == 3): | |
charList += string.punctuation | |
elif(choice == 4): | |
break | |
else: | |
print("Invalid option.") | |
passwd_gen = [] | |
print(" ") | |
for i in range(passwd_length): | |
randomchar = random.choice(charList) | |
passwd_gen.append(randomchar) | |
print("Password we created for you; " + "".join(passwd_gen)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
📋 Requirements
• python3