Skip to content

Instantly share code, notes, and snippets.

@ufuayk
Created November 10, 2024 08:48
Show Gist options
  • Save ufuayk/b80ee074d8769b5441da7ce9a9ce6389 to your computer and use it in GitHub Desktop.
Save ufuayk/b80ee074d8769b5441da7ce9a9ce6389 to your computer and use it in GitHub Desktop.
A Strong Password Generation Tool
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))
@ufuayk
Copy link
Author

ufuayk commented Nov 10, 2024

📋 Requirements

• python3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment