Untitled
unknown
plain_text
a year ago
1.3 kB
2
Indexable
import random print("Hello, Welcome to our Password Generator v1.0!") length = int(input("How long do you want your password to be? ")) want_numbers = input("Do you want to use numbers? ") want_symbols = input("Do you want to use special characters? ") password = [] letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'] numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] symbols = ['!', '#', '$', '%', '&', '(', ')', '*', '+'] num_letters = length if want_numbers.lower() == "yes": num_numbers = random.randint(1, length - 1) num_letters -= num_numbers else: num_numbers = 0 if want_symbols.lower() == "yes": num_symbols = random.randint(1, length - num_numbers - 1) num_letters -= num_symbols else: num_symbols = 0 for c in range(num_letters): password += random.choice(letters) for c in range(num_numbers): password += random.choice(numbers) for c in range(num_symbols): password += random.choice(symbols) password_list = list(password) random.shuffle(password_list) password = ''.join(password_list) print("Your password is: " + "".join(password))
Editor is loading...
Leave a Comment