0% found this document useful (0 votes)
142 views1 page

Random Password Generator

This Python code generates random passwords of a maximum length of 12 characters. It imports the random and array modules. Lists are created containing numbers, uppercase letters, lowercase letters and symbols. These lists are combined and shuffled to randomly select characters to build a temporary password string. The string is then shuffled and printed as the final random password.

Uploaded by

Ayush Rane
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
142 views1 page

Random Password Generator

This Python code generates random passwords of a maximum length of 12 characters. It imports the random and array modules. Lists are created containing numbers, uppercase letters, lowercase letters and symbols. These lists are combined and shuffled to randomly select characters to build a temporary password string. The string is then shuffled and printed as the final random password.

Uploaded by

Ayush Rane
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

#KFBSC(IT)047 AYUSH RANE

#RANDOM PASSWORD GENERATOR (PYTHON PROJECT)


import random
import array

max_length= 12

numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
lowercase_characters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
'i', 'j', 'k', 'm', 'n', 'o', 'p', 'q',
'r', 's', 't', 'u', 'v', 'w', 'x', 'y',
'z']

uppercase_characters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',


'I', 'J', 'K', 'M', 'N', 'O', 'p', 'Q',
'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y',
'Z']

symbols = ['@', '#', '$', '%', '=', ':', '?', '.', '/', '|', '~', '>',
'*', '(', ')', '<']

combined_list = numbers + uppercase_characters + lowercase_characters + symbols

rand_digit = random.choice(numbers)
rand_upper = random.choice(uppercase_characters)
rand_lower = random.choice(uppercase_characters)
rand_symbol = random.choice(symbols)

temp_pass = rand_digit + rand_upper + rand_lower + rand_symbol

for x in range(max_length - 4):


temp_pass = temp_pass + random.choice(combined_list)
temp_pass_list = array.array('u', temp_pass)
random.shuffle(temp_pass_list)
password = ""
for x in temp_pass_list:
password = password + x

print(password)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy