321,026 views
25 votes
25 votes
Create a secure password (10 points)

Ask the user how long they want their password to be, then return a randomized password that includes all the letters of the alphabets, capitalization, numbers, and special characters.

User Midwire
by
3.3k points

1 Answer

26 votes
26 votes

Answer:

python

Step-by-step explanation:

import random

secret_length = input("how long you want the secret to be?\\")

secret_length = int(secret_length)

characters = r"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789$%^&*("
secret = ""

for i in range(secret_length):

secret = secret + random.choice(characters)

print(secret)

User Tabria
by
3.2k points