234k views
1 vote
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 ShabbyDoo
by
5.9k points

1 Answer

6 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 Rangi Lin
by
7.1k points