68+ Python Password Generator Examples

This post contains a total of 68+ Hand-Picked Python password generator examples with Source Code. All these password generators are made purely using python programming language.

You can use the source code of these examples with credits to the original owner.

Related Posts

Click a Code to Copy it.

Python Password Generator Examples

1. Alexander Serov

Made by Alexander Serov. The program generates a random 12 digits password using alphabets and numbers. ( Source )

import random
str1 = '123456789'
str2 = 'qwertyuiopasdfghjklzxcvbnm'
str3 = str2.upper()
str4 = str1+str2+str3
ls = list(str4)
random.shuffle(ls)
psw = ''.join([random.choice(ls) for x in range(12)])
print(psw)

2. By Alejandro Osorio

Made by Alejandro Osorio. Enter password length you want to generate a random one containing symbols, alphabets and numbers. ( Source )

from random import SystemRandom
longitud = int(input())
g = longitud

valores="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ<=>@#%&+"
cryptogen = SystemRandom()
p = "" 
while longitud > 0:

     p = p + cryptogen.choice(valores)
     longitud = longitud - 1 
     
print("longitud: "+str(g))
print("Password: "+str(p))

3. By Lothar

PW generator by lothar. The pw generator uses 4 different character sets, each stored in a tuple. First element in tuple is the number of characters to use from the current set. Character sets and the numbers can be adapted. Additional sets can be included. After randomly picking the defined number of characters from the sets and collect them in a list, this list will be shuffled with sample() finally. Generates a random 14 digit password. ( Source )

from random import choices, sample

chrlo = (4, 'abcdefghijklmnopqrstuvwxyz')
chrup = (4, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')
digit = (3, '0123456789')
punct = (3, '/:*[]&@-$%(?!)')
res = []
lst = [chrlo, chrup, digit, punct]

[res.extend(choices(i[1], k= i[0])) for i in lst]
print(''.join(sample(res, len(res))))

4. By Shaurya Pratap S

Made by Shaurya Pratap S. The program generates a random password of random length of between 6 – 18. ( Source )

import string
from random import *

letters = string.ascii_letters
digits = string.digits 
symbols = string.punctuation
chars = letters + digits + symbols
min_length = 6
max_length = 18
password = "".join(choice(chars) for x in range(randint(min_length, max_length)))

print("YOUR PASSWORD : " + password + "\n")
print("PLZ SAVE IN TEXT FILE, NOT IN PAPER. SAVE TREES, SAVE NATURE\n\n")
print("Wow that rhymed\n\n")
print("""Text file is more secure,
        changing password is the safest cure.\n\n""")

5. By Ole

Made by Ole. Enter password length between 8 – 32 to generate a random password. ( Source )

import random 

chars = list("! \" # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ 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 { | } ~".split(' '))
try:
    l = int(input())
    if l < 8 or l >32:
        print ("The length must be between 8 and 32 characters!")
    else:
        password = ""
        for c in range(l):
            password = password + random.choice(chars)
        print ("Your password is: ", password)
        print ("\n\nTry my Password Strength Tester code to check if you\'re generated password is save ;-)")
except:
    print ("Input an integer please!")

6. By Joshua Evuetapha

Created by Joshua Evuetapha. The program generates a random 12 digits password containing alphabets, numbers and symbols. ( Source )

import random

#length of the password 
LENGTH = 12

#list if characters used in generating the password
characters = ["0123456789", "[email protected]#$%^&*", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz"]

#empty password string
password = ""


for i in range(LENGTH):
     #choose a random index for the list
     index = random.randint(0, len(characters) - 1)
     #choose a random index for strings in the list
     index2 = random.randint(0, len(characters[index]) - 1)
     # concatenate the randomly generated character to the password string
     password += characters[index][index2]

#print the password 
print(password)

7. By David Ashton

Made by David Ashton. A small python program that generates a random password. You need to input the password length you need. ( Source )

from random import sample as s
print("".join(s([chr(c) for c in range(33, 127)], int(input()))))

8. By Prabhakar Dev

Made by Prabhakar Dev. Enter password length you need, there is no limit to the length of the password you can generate. ( Source )

import random
alnm='[email protected]#$%&-+*/!?\(\)\"\':;'
password=""
l=int(input("Enter the length of the password-> "))
print("Length is ",l)
for x in list(range(0,l)):
  password+=alnm[random.randint(0,(len(alnm)-1))]
print("\nPassword is ",password)

9. By YOONSU KIM

Made by YOONSU KIM. Enter the password length you need, the length must be between 3 – 100. ( Source )

import random, re, string

def validate(password):
  letter = re.search(r"[a-zA-Z]",
    password) is None
  digit = re.search(r"\d", password) is None
  symbol = re.search(r"\W", password) is None
  return not(letter or digit or symbol)

def random_password(length):
  charset = (
    string.ascii_letters
    + string.digits
    + string.punctuation
  )
  return ''.join((
    random.choice(charset)
      for ch in range(length)
  ))


def main():
  try:
    # Enter the length of your password
    passwd_len = int(input())
  except ValueError:
    print("Please enter a number!\nNumber need 3~100")
    return 1
        
  if passwd_len >= 3 and passwd_len <= 100:
    password = ""
    while not validate(password):
      password = random_password(passwd_len)
    print("Your password length = ",passwd_len)
    print("This is your password!")
    print("-"*30)
    print(password)
        
  else:
    print("Please enter a number between 3 and 100.")
main()

10. By Da GD Bot

Made by Da GD Bot. A simple Python Password Generator. ( Source )

import random
import string

print("Password Generator")

letters = list(map(str, string.ascii_letters))
digits = list(map(str, string.digits))
punctuations = list(map(str, string.punctuation))

pass_len = int(input("Password Length : "))
new_pass = []
for i in range(pass_len):
    x = random.randint(1, 3)
    if x == 1:
        new_pass.append(random.choice(letters))
    elif x == 2:
        new_pass.append(random.choice(digits))
    elif x == 3:
        new_pass.append(random.choice(punctuations))

print(f"Password Generated : {''.join(map(str,new_pass))}")

11. By Giannis Macheras

Made by Giannis Macheras. Enter the password length you need to generate a random password. ( Source )

import random

def generatePassword(length):
    characters = [chr(n) for n in range(33, 127)]
    return "".join(random.choices(characters, k=length))

length = int(input("Enter your password length: "))
print(length)
print(generatePassword(length))

12. By Prafull Epili

Made by Prafull Epili. The program generates a random password and its MD5 Hash when you enter the password length. ( Source )

import string,random,hashlib,datetime

def run(lenght):
        print(length)
        cap_Small = string.ascii_letters
        digits = string.digits
        # You can use string.punctuation here
        pun = "#$%[email protected]₹&*+?!"

        combined = []
        combined.extend(list(cap_Small ))
        combined.extend(list(digits ))
        combined.extend(list(pun ))
        random.shuffle(combined )

        password="".join(random.sample(combined,length))
        print("🔰Your password is: ",password)
        hash = hashlib.md5(password.encode())
        print("🔰hash MD5:",hash.hexdigest())
        print(f"🔰{datetime.datetime.now()}")
        
length = int(input())
if length > 73:
    print("\npassword length can not greater then 73")
else:
    run(length)

13. By Demin Roman

Made by Demin Roman. Enter the password length you want. ( Source )

import random
#Valid characters
en = 'ABCDIFGHIJKLMNOPRSTUVWXYZ'
list = []
for i in en:
    list.append(i)
    list.append(i.lower())

col = input('new password:\n')
n = 0
st = ''
while n != int(col):
    st += list[random.randint(0,len(list)-1)]
    n += 1
print(st)

14. By Anjali Sahu

Made by Anjali Sahu. The program generates a random 8 digits password. ( Source )

import random as r
alpha=list("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")
digit=list("1234567890")
symbols=list("[email protected]#$%^&*<>_~")
l=[]
for i in range(3):
    l.append(r.choice(alpha))
for i in range(3):
    l.append(r.choice(digit))
for i in range(2):
    l.append(r.choice(symbols))
x=r.shuffle(l)
print("".join(l))

15. By Charlierashi

Made by Charlierashi. This program generates a random 12 digits password containing numbers and alphabets. ( Source )

import random
password =""
for i in range(12):
    password += random.choice(list("1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM"))
print(password)

16. By Rajeev kumar

Made by Rajeev kumar. Generate a password with length “passlen” with no duplicate characters in the password, you can even change the value of length if you want less characters of passwords. ( Source )

import random
s = "a[email protected]#$%^&*()?"
passlen = 10
p =  "".join(random.sample(s,passlen ))
print(p)

17. By Nova

Made by Nova. The program generates a random password of random length between 8 – 32. ( Source )

from random import *;
import string;
alphabets = ('a','a','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 = (1,2,3,4,5,6,7,8,9,0)
special = ('@','!','#','$','%','^','&','*','+','-','/','.','_','=','?','<','>',';',':','|','~','{','}','(',')','[',']','`','"',',','')
total = (alphabets, numbers, special)
lst = list()
length = randrange(8,33)
for i in range(length):
	letter = choice(choice(total))
	if i%2 is 0 and letter in alphabets:
		letter = letter.upper()
	lst.append(letter)

print("     Password Generator")
print("NOTE : Length Of Password Can Be Between 8 and 32")
print("Length Of Password Is Randomly Set To ",length)
print("Password Generated : ",end=" ")
for i in lst:
	print(i,end="")
print()

18. By Jacob McKee

Made by Jacob McKee. This Python Password Generator generates a random password containing numbers and alphabets, the password length will be of 10 digits. ( Source )

import random

chars = "abcdefghijklmnopqrstuvwxyz1234567890"

password = "".join(random.choice(chars) for x in
range(0, 10))

print(password)

19. By Pea Jay

Made by Pea Jay. Enter the password length you want to generate. ( Source )

import random

# input the length of the password 
n = int(input())

password = ""
for i in range(n):
    password += chr(random.randint(33, 127))
print(password)

20. By Joel Kahora

Made by Joel Kahora. The program generates a random 9 digits password. ( Source )

import random
import string 
def passwordGenerator(n):
    allChars= list(string.ascii_letters)     +list(string.digits)+list(string.punctuation)
    password = []
    for i in range(n):
        tmp = random.choice(allChars)
        password.append(tmp)
    res = "".join(password)
    return res

print (passwordGenerator(9))

21. By Om Maurya

Made by Om Maurya. Enter password length you want to generate between 3 – 11. ( Source )

on = input()
import random
f1=["0","1","2","3","4","5","6","7","8","9","!","@","#","$","%","^","&","*",
"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"]
f2=["0","1","2","3","4","5","6","7","8","9","!","@","#","$","%","^","&","*",
"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"]
f3=["0","1","2","3","4","5","6","7","8","9","!","@","#","$","%","^","&","*",
"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"]
f4=["0","1","2","3","4","5","6","7","8","9","!","@","#","$","%","^","&","*",
"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"]
f5=["0","1","2","3","4","5","6","7","8","9","!","@","#","$","%","^","&","*",
"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"]
f6=["0","1","2","3","4","5","6","7","8","9","!","@","#","$","%","^","&","*",
"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"]
f7=["0","1","2","3","4","5","6","7","8","9","!","@","#","$","%","^","&","*",
"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"]
f8=["0","1","2","3","4","5","6","7","8","9","!","@","#","$","%","^","&","*",
"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"]
f9=["0","1","2","3","4","5","6","7","8","9","!","@","#","$","%","^","&","*",
"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"]
f10=["0","1","2","3","4","5","6","7","8","9","!","@","#","$","%","^","&","*",
"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"]
fs1=random.choice(f1)
fs2=random.choice(f2)
fs3=random.choice(f3)
fs4=random.choice(f4)
fs5=random.choice(f5)
fs6=random.choice(f6)
fs7=random.choice(f7)
fs8=random.choice(f8)
fs9=random.choice(f9)
fs10=random.choice(f10)
if on == "4":
   print ("Your password is : "+fs1+fs2+fs3+fs4)
elif on == "5":
    print ("Your password is : "+fs1+fs2+fs3+fs4+fs5)
elif on == "6":
    print ("Your password is : "+fs1+fs2+fs3+fs4+fs5+fs6)
elif on == "7":
    print ("Your password is : "+fs1+fs2+fs3+fs4+fs5+fs6+fs7)
elif on == "8":
    print ("Your password is : "+fs1+fs2+fs3+fs4+fs5+fs6+fs7+fs8)
elif on == "9":
    print ("Your password is : "+fs1+fs2+fs3+fs4+fs5+fs6+fs7+fs8+fs9)
elif on == "10":
    print ("Your password is : "+fs1+fs2+fs3+fs4+fs5+fs6+fs7+fs8+fs9+fs10)

22. By Najmul Huda

Made by Najmul Huda. Enter the password length you need to generate a random one. ( Source )

import string
import random
 
def generate_password(size):
    all_chars = string.ascii_letters + string.digits + string.punctuation
    password = ''
    for char in range(size):
        rand_char = random.choice(all_chars)
        password = password + rand_char
    return password
 
pass_len = int(input('How many characters in your password?'))
new_password = generate_password(pass_len)
print('Your new password: ', new_password)

23. By Harsh Singh

Made by Harsh Singh. ( Source )

import string
import random

pgen =  None

passlen = input("\nEnter the length of password: ")
passlen = int(passlen)

s = string.ascii_letters + string.punctuation + string.digits

pgen = "".join(random.sample(s,passlen))
print(f"\n The password generated is {pgen}")

24. By Kailash Loncha

Made by Kailash Loncha. ( Source )

import random
pass_len = int(input("ENTER LENGTH OF YOUR PASSWORD  :  "))
while pass_len < 8 or pass_len > 38:
    print("\n\nLENGTH IS NOT VALID PLEASE ENTER LENGTH BETWEEN 8 AND 38")
    pass_len = int(input("\n\nENTER LENGTH OF YOUR PASSWORD  :  "))
password = []
chars = ['#', '$', '%', '&','*', '+', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9','?', '@', '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']
for i in range(pass_len):
    ran_pass= random.randint(1,len(chars)-1)
    password.append(chars[ran_pass])
password_is = ''.join(password)
print("\n##===========================================##");
print ("\n\nYOUR PASSWORD IS  :  " + password_is)
print("\n\n##==========================================##");

25. By Mohammed Raiyyan

Made by Mohammed Raiyyan. Generate a random password of numbers, alphabets and symbols by entering the password length. ( Source )

# importing Library
import random

# asking length of the password required
len = int(input("Enter the Length of the Password: "))

s ="[email protected]#$%^&*"

p = "".join(random.sample(s,len))
print(p)

26. By Mustafa Ansari

Made by Mustafa Ansari. The program generates a random 12 digit long password. ( Source )

import random

char_list = [0,1,2,3,4,5,6,7,8,9,"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","@","!","#","$","%","^","&","*"]

password = ""
for num in range(12):
    random_char = random.choice(char_list)
    password = password + str(random_char)

print(password)

27. By Brendon

Made by Brendon. Enter the password length you need. ( Source )

import random
lettersdown = "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"
ld = lettersdown.split(" ")
lettersup = "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"
lu = lettersup.split(" ")
x = 0
passwconv = ""
specialchars = False

charnum = input("Enter the number of characters the password has to be.\n")
digits = int(charnum)
while x < digits:
	nu = random.choice(["1", "2", "3", "4", "5", "6", "7", "8", "9"])
	lur = random.choice(lu)
	ldr = random.choice(ld)
	elmlist = (nu, lur, ldr)
	if specialchars:
		pass
	charadding = random.choice(elmlist)
	passwconv = passwconv + charadding
	x = x + 1	
print(passwconv)

28. By zDev GameDev

Made by zDev GameDev. The program generates a random 8 digits password using numbers. ( Source )

import random
print("Password Generator\n")
print("Your Password: \n")
for x in range(8) :
    password = random.randint(0, 8)
    print(password, end = '')

29. Si Thu Htun

Made by Si Thu Htun. The program generates a random password of random length, the length of the password will be between 6 – 30. ( Source )

import random

LOWERCASE_CHARS = tuple(map(chr, range(ord('a'), ord('z') + 1)))
UPPERCASE_CHARS = tuple(map(chr, range(ord('A'), ord('Z') + 1)))
DIGITS = tuple(map(str, range(0, 10)))
SPECIALS = ('!', '@', '#', '$', '%', '^', '&', '*')

SEQUENCE = (LOWERCASE_CHARS,
            UPPERCASE_CHARS,
            DIGITS,
            SPECIALS,
            )


def generate_random_password(total, sequences):
    r = _generate_random_number_for_each_sequence(total, len(sequences))

    password = []
    for (population, k) in zip(sequences, r):
        n = 0
        while n < k:
            position = random.randint(0, len(population) - 1)
            password += population[position]
            n += 1
    random.shuffle(password)

    while _is_repeating(password):
        random.shuffle(password)

    return ''.join(password)


def _generate_random_number_for_each_sequence(total, sequence_number):
    """ Generate random sequence with numbers (greater than 0).
        The number of items equals to 'sequence_number' and
        the total number of items equals to 'total'
    """
    current_total = 0
    r = []
    for n in range(sequence_number - 1, 0, -1):
        current = random.randint(1, total - current_total - n)
        current_total += current
        r.append(current)
    r.append(total - sum(r))
    random.shuffle(r)

    return r


def _is_repeating(password):
    """ Check if there is any 2 characters repeating consecutively """
    n = 1
    while n < len(password):
        if password[n] == password[n - 1]:
            return True
        n += 1
    return False


if __name__ == '__main__':
    print(generate_random_password(random.randint(6, 30), SEQUENCE))

30. By AradXr

Made by AradXr. It generates a random password that is 15 digits in length. ( Source )

import random
#import pyperclip as p
lower = "qwertyuiopasdfghjklzxvcbnm"
upper = "QWERTYUIOPASDFGHJKLZXCVBNM"
symbols = "@#$_&-+()/*:;!?~`|^={}\%[]"
numbers = "1234567890"

all= lower + upper + symbols + numbers 
length = 15
#length = int ( input("Set password length : "))
password = "".join(random.sample( all , length ))
print (password + "\a")
print ("Password generated")

31. By GW Andrew

Made by GW Andrew. The program generates a random password of random length between 4 – 32. ( Source )

import random

caracters=["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','1','2','3','4','5','6','7','8','9','0','+','-','$','&','@','#','_','(',')','/','*',':',';','!','?','~','|','÷','×','£','€','^','°','=','{','}','%','[',']','<','>']

def ran():
    print(random.choice(caracters))

number = random.randint(4,32)

while number != 0 :
    ran()
    number = number - 1

32. By Techno Hassaan

Made by Techno Hassaan. Enter the password length to generate a random password. ( Source )

import random

upper_letter = "ABCDEFGHIJKLMNOPQURSTUVWXYZ"
lower_letter = upper_letter.lower()
numbers = "1234567890"
symbols = "#/$&_*:;!?\=°π÷׶∆%¢£¥¥|`~=(){}[]"

Set_up = upper_letter + lower_letter + numbers + symbols 
length = int(input())

password =''.join(i for i in random.sample(Set_up, length))

print (f'Your password is : {password}')

33. By Alon

Made by Alon. Enter the password length you want to generate. ( Source )

import random
import string
try:
	input = int(input())
except:
	input = 10
def randomString(stringLength):
	letters = string.ascii_letters
	letters += "[email protected]#$%^&*_-=+)(?,/\.;:±§`~><|}{]['€£¥…"
	return ''.join(random.choice(letters) for i in range(stringLength))
print(randomString(input))

34. By Savely Kotofeich

Made by Savely Kotofeich. A basic Python Password Generator. ( Source )

import random

def passgen(a):
    c = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz-_&[email protected];!?"
    s = 0
    while s<=a:
        s+=1
        print(random.choice(c),end="")


a = int(input("Password length:\n"))
passgen(a)

35. By HARDIK JAIN

Made by HARDIK JAIN. The program generates a random 8 digit password. ( Source )

import random
X="[email protected]#€¥$¢£&ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Y=8
p="".join(random.sample(X,Y))
print(p)

36. By Gabriel Felix dos Santos

Made by Gabriel Felix dos Santos. Enter an integer number (pass’s length) to get a random password. ( Source )

def pass_generator(length):
    """
     * Parameters:
        . length (int) *
     * Return:
        . result (string) *
     * Asymptotic: O(n), where 'n' is password length
    """
    # Assertions
    assert(type(length) == type(2)), "The parameter must be an integer\n";
    
    # Imports
    from random import randint;
    
    # Variables
    chars = [x for x in range(32, 127, 1)] # storage decimal ascii values of available chars in passwords
    result = ""
    
    # Procces
    for new_char in range(0, length, 1):
        result += str(chr(chars[randint(0, len(chars) - 1)])) # tranformation of decimal int to char, and char to string
        
    # Return
    return(result)
    
# Test
length = None
try:
    length = int(input())
except:
    print("An error ocurred.\n")
else:
    new_pass = pass_generator(length)
    print("Your random password is: {0}\n".format(new_pass))

37. By Rahman Hakim

Made by Rahman Hakim. The program generates a random 13 digits password. ( Source )

import numpy as np
import string
import random

__author__ = "Rahman/Mochida"

def passGen(n):
    char = f"[^~`|÷×=%@&_-+/*:;!?$]" #Symbols
    num = f"[1-9]" #Numbers
    letters = string.ascii_uppercase #Uppercases
    letters2 = string.ascii_lowercase #Lowercases
    total = letters + letters2 + num + char #Adding all the characters into one line
    return "".join(random.choice(total) for i in range(n)) #Returning the result to the function
    
passw = passGen(13) #Password length
print("Your Password is: ", passw)
print("Thanks for using Mochida's password generator!")

38. By IDIOT KID

Made by IDIOT KID. The program will generate a 8 digit password, change password length by changing ‘len’. ( Source )

import random

l = "abcdefghijklmnopqrstuvwxyz"
u = "ABCDEFGHIJKLMNOPQESTUVWXYZ"
n = "0123456789"
s= "@#$&@()£¢€¥©®.™"

str = l + u + n + s
len = 8
password = "".join(random.sample(str,len))
print("YOUR NEW RANDOM PASSWORD OF 8 CHARACTER IS : " + password)

print("\nSPREAD LOVE AND KEEP SMILING")

39. By Ramon Berenguer

Made by Ramon Berenguer. The program generates a 4 digit password containing numbers and letters. ( Source )

import random

class Password:
    def __init__(self, cont):
        self.cont = cont

    def __getitem__(self, index):
        return self.cont[index + random.randint(-1, 1)]

    def __len__(self):
        return random.randint(0, len(self.cont)*2)

vague_list = Password(["A", "B", "C", "D", "E"])
print(len(vague_list))
print(len(vague_list))
print(vague_list[2])
print(vague_list[2])

40. By K. John

Made by K.John. It generates a random 10 digit password that contains alphabets and numbers. It also saves your generated password as a csv file in your local computer. ( Source )

import string
from random import choice
import csv
import hashlib


def create_password(func=None, length=10):
    chars = string.ascii_lowercase + string.ascii_uppercase + string.digits
    password = ''.join(choice(chars) for _ in range(length))
    
    if func is not None:
        if callable(func):
            print(f'Password created: {password}')
            func(password)
    else:
        return password

@create_password
def password_to_csv(password, file_name='passwords'):
    with open(file_name, 'a') as f:
        csv_file = csv(f)
        csv_file.write_rows([password])

41. By Ayush kumar

Made by Ayush kumar. The program generates a random password containing, 8 Characters, 1 Uppercase, 1 lowercase, 1 Special character, 5 digits. ( Source )



import random
def gen_password(length=8):
  l = ["#", "@", "&", "$", "%"]
  upper = chr(random.randint(65,90))
  lower = chr(random.randint(97,122))
  special = random.choice(l)
  digits = random.randint(10000,99999)
  code = upper+lower+special+ str(digits)
  temp_pass = random.sample(code, length)
  password = ("").join(temp_pass)
  return password


result = gen_password()
print("A password for you ",result)
print("\n\n\n\n\nCreated by me")

42. By TOLUENE

Made by TOLUENE. Input an integer that is the length of your desired password. ( Source )

import random
length=int(input())

lowercase="abcdefghijklmnopqrstuvwxyz"
uppercase="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
number="0123456789"
specialcharacter="@#%&-+()?!;:*,_/^={}\[]"
password=""

while(len(password)<length):
 mylist=[random.choice(uppercase),random.choice(lowercase),random.choice(number),random.choice(specialcharacter)]
 password+=random.choice(mylist)

print(f"Suggested {length} lengths strong password is :\n")
print(password)

43. By Gianmarco

Made by Gianmarco. HOW TO USE – input : password length (max.30), letters[y/n]?, numbers[y/n]?, special characters[y/n]? ( Source )

from random import randint

#password lenght 

lenght=int(input('how many characters? (max_30)'))

if lenght<30 and lenght>0:
   print() 
elif lenght>31:
    exit('max 30 characters')
else:
    exit('not valid character')

#password with letters?
a=input('letters[y/n]?\n')
if a=="y":
   a=1
elif a=="n":
   a=0
else:
   exit("not valid character")

#password with numbers?
b=input('numbers[y/n]?\n')
if b=="y":
   b=1
elif b=="n":
   b=0
else:
   exit("not valid character")
   
#password with symbols?   
c=input('symbols[y/n]?\n')
if c=="y":
   c=1
elif c=="n":
   c=0
else:
   exit("not valid character")


letyn =int(a)
numyn =int(b)
symyn =int(c)

#all characters available
let="abcdefghilmnopqrstuvzxkjwyQWERTYUIOPASDFGHJKLZXCVBNM"
num="1234567890"
sym="!$%^&@*()<>?/_+-~.,"
pw=[]


if letyn==1 and numyn==1 and symyn==1:
    for i in range(10):
     x = randint(0 ,len(let)-1)
     y = randint(0,len(num)-1)
     z = randint(0, len(sym)-1)
     pw.append (i+1)
     pw[i] = let[x]+num[y]+sym[z]

elif letyn==0 and  numyn==1 and symyn==1:
  for i in range(15):
   y = randint(0,len(num)-1)
   z = randint(0, len(sym)-1)
   pw.append(i+1)
   pw[i] = num[y]+sym[z]

elif letyn==1 and numyn==1 and symyn==0:
    for i in range(15):
     x = randint(0,len(let)-1)
     y = randint(0,len(num)-1)
     pw.append(i+1)
     pw[i] = let[x]+num[y]

elif letyn==1 and numyn==0 and symyn==1:
    for i in range(15):
     x = randint(0,len(let)-1)
     z = randint(0, len(sym)-1)
     pw.append(i+1)
     pw[i] = let[x]+sym[z]

elif letyn==0 and numyn==1 and symyn==0:
    for i in range(30):
     x = randint(0,len(let)-1)
     pw.append(i+1)
     pw[i] = num[y]

elif letyn==1 and numyn==0 and symyn==0:
    for i in range(30):
     x = randint(0,len(let)-1)
     pw.append(i+1)
     pw[i] = let[x]
     
elif letyn==0 and numyn==0 and symyn==1:
    for i in range(10):
     z = randint(0, len(sym)-1)
     pw.append (i+1)
     pw[i] = sym[z]
     
print("password: ")
print(''.join(pw)[:lenght])

44. By andr3

Made by andr3. Type 1 for a simple 5 normal ,capital letters and numbers password, Type 2 for a good 10 random numbers and letters, Type 3 for a strong 15 capital, normal letters and numbers, Type 4 for an unbreakable 20 capital and normal letters, numbers and symbols. ( Source )

choice = int(input(""))

import random 

#1
char1 = "abcdefgehijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
passlen = 5
p1 = "".join(random.sample(char1,passlen ))

#2
char2 = "0123456789abcdefgehijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
passlen = 10
p2 =  "".join(random.sample(char2,passlen ))

#3
char3 = "abcdefgehijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
passlen = 15
p3 =  "".join(random.sample(char3,passlen ))

#4
char4 = "a[email protected]#$%^&*()_+"
passlen = 20
p4 =  "".join(random.sample(char4,passlen ))


if choice == 1:
    passlen = 5
    print ("Your password: ",p1)
    print ("Password quality: Weak")
elif choice == 2:
    passlen = 10
    print ("Your password: ",p2)
    print ("Password quality: Good")
elif choice == 3:
    passlen = 15
    print ("Your password: ",p3)
    print ("Password quality: Strong")
elif choice == 4:
    passlen = 20
    print ("Your password: ",p4)
    print ("Password quality: Unbreakable")   
else:
    print("Invalid input")

45. By Sagar

Made by Sagar. The program generates a random 8 digits password. ( Source )

import random

x=['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']
w=['0','1','2','3','4','5','6','7','8','9']
y=random.randrange(1,24)
a=random.randrange(1,24)
b=random.randrange(1,24)
c=random.randrange(1,10)
e=random.randrange(1,10)
d=random.randrange(1,24)
g=random.randrange(1,10)
h=random.randrange(1,10)
print(x[y]+w[h]+x[a]+w[c]+x[b]+w[e]+x[d]+w[g])

46. By loliconshik3

Made by loliconshik3. First enter the amount of passwords that you want to generate and after that enter the length of the password you want. ( Source )

import random

chars = '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
kolvo = int(input("Number of passwords?" + "\n"))
dlina = int(input("Password length?" + "\n"))
for n in range (kolvo):
    password =''
    for i in range (dlina):
        password += random.choice(chars)
    print (password)
    

47. By noobcøder

Made by noobcøder. Enter the length of the password that you want to generate, the length must be between 3 – 100. ( Source )

import random, re, string

def validate(password):
  # check if password contains:
  # a letter..
  letter = re.search(r"[a-zA-Z]",
    password) is None
  # a digit..
  digit = re.search(r"\d", password) is None
  # a symbol..
  symbol = re.search(r"\W", password) is None
  # the blood of a virgin... ok, no.  
  return not(letter or digit or symbol)


def random_password(length):
  charset = (
    string.ascii_letters
    + string.digits
    + string.punctuation
  )
  return ''.join((
    random.choice(charset)
      for ch in range(length)
  ))


def main():
  try:
    # Enter the length of your password
    passwd_len = int(input())
  except ValueError:
    print("Please enter a number!")
    return 1
        
  if passwd_len >= 3 and passwd_len <= 100:
    password = ""
    while not validate(password):
      password = random_password(passwd_len)
    print("Your shiny brand new password:")
    print("-"*30)
    print(password)
        
  else:
    print("Please enter a number between 3 and 100.")


if __name__ == "__main__":
    main()

48. By DefvD

Made by DefvD. Basic Python Password Generator. ( Source )

import random
import string

def pass_gen():
    try:
        howmany = int(input('How many characters your password should have: \n'))
        characters = string.ascii_letters
        replacer = characters.replace(' ', ', ')
        x = list(str(e) for e in replacer*1337)
        print('Your new password: ', ''.join(random.choice(x) for e in range(howmany)))
    except:
        print("Use only numbers.")
        pass_gen()
        
if __name__ == '__main__':
    pass_gen()

49. By Daniel Fragomeli

Made by Daniel Fragomeli. The program generates a random 12 digit password. ( Source )

import string
from random import *

chars = string.ascii_letters + string.digits + string.punctuation

length = 12
password = "".join(choice(chars) for i in range(length))
print(password)

50. By just trying to think

Made by just trying to think. Enter password length to generate a random one. ( Source )

import string as s
import random
# Input 
u = int(input())
# All printable symbols (replace function delete space)
pr = s.printable.replace(" ", "")

al = list(pr)

pswrd = ""

for c in range(0, u):
    # Random digit 0 to length of all printable symbols
    i = random.randint(0, len(al))
    # Add to password symbol from list of printable with
    # random index
    pswrd += al[i]

# Print password
print(pswrd)

51. By Orlov Daniil

Made by Orlov Daniil. The program generates a 10 digits random password. ( Source )


print("Your password:")
print("")
import random
one = random.choice(["q","w","e","r","t","y","u","i","o","p","a","s","d","f","g","h","j","k","l","z","x","c","v","b","n","m","1","2","3","4","5","6","7","8","9","0","+","=","%","_","|","<",">","{","}","[","]","!","@","#","$","/","^","&","*","(",")","`","~","-",":",";",",","?","."])
two = random.choice(["q","w","e","r","t","y","u","i","o","p","a","s","d","f","g","h","j","k","l","z","x","c","v","b","n","m","1","2","3","4","5","6","7","8","9","0","+","=","%","_","|","<",">","{","}","[","]","!","@","#","$","/","^","&","*","(",")","`","~","-",":",";",",","?","."])
three = random.choice(["q","w","e","r","t","y","u","i","o","p","a","s","d","f","g","h","j","k","l","z","x","c","v","b","n","m","1","2","3","4","5","6","7","8","9","0","+","=","%","_","|","<",">","{","}","[","]","!","@","#","$","/","^","&","*","(",")","`","~","-",":",";",",","?","."])
four = random.choice(["q","w","e","r","t","y","u","i","o","p","a","s","d","f","g","h","j","k","l","z","x","c","v","b","n","m","1","2","3","4","5","6","7","8","9","0","+","=","%","_","|","<",">","{","}","[","]","!","@","#","$","/","^","&","*","(",")","`","~","-",":",";",",","?","."])
five =random.choice(["q","w","e","r","t","y","u","i","o","p","a","s","d","f","g","h","j","k","l","z","x","c","v","b","n","m","1","2","3","4","5","6","7","8","9","0","+","=","%","_","|","<",">","{","}","[","]","!","@","#","$","/","^","&","*","(",")","`","~","-",":",";",",","?","."])
six =random.choice(["q","w","e","r","t","y","u","i","o","p","a","s","d","f","g","h","j","k","l","z","x","c","v","b","n","m","1","2","3","4","5","6","7","8","9","0","+","=","%","_","|","<",">","{","}","[","]","!","@","#","$","/","^","&","*","(",")","`","~","-",":",";",",","?","."])
seven =random.choice(["q","w","e","r","t","y","u","i","o","p","a","s","d","f","g","h","j","k","l","z","x","c","v","b","n","m","1","2","3","4","5","6","7","8","9","0","+","=","%","_","|","<",">","{","}","[","]","!","@","#","$","/","^","&","*","(",")","`","~","-",":",";",",","?","."])
eight =random.choice(["q","w","e","r","t","y","u","i","o","p","a","s","d","f","g","h","j","k","l","z","x","c","v","b","n","m","1","2","3","4","5","6","7","8","9","0","+","=","%","_","|","<",">","{","}","[","]","!","@","#","$","/","^","&","*","(",")","`","~","-",":",";",",","?","."])
nine =random.choice(["q","w","e","r","t","y","u","i","o","p","a","s","d","f","g","h","j","k","l","z","x","c","v","b","n","m","1","2","3","4","5","6","7","8","9","0","+","=","%","_","|","<",">","{","}","[","]","!","@","#","$","/","^","&","*","(",")","`","~","-",":",";",",","?","."])
ten =random.choice(["q","w","e","r","t","y","u","i","o","p","a","s","d","f","g","h","j","k","l","z","x","c","v","b","n","m","1","2","3","4","5","6","7","8","9","0","+","=","%","_","|","<",">","{","}","[","]","!","@","#","$","/","^","&","*","(",")","`","~","-",":",";",",","?","."])
password = one + two + three + four + five + six + seven + eight + nine + ten
print(password)
print("") 

52. By Vishnu

Made by Vishnu. Enter the length of the password you want to generate. ( Source )

import random      # This "random" attribute will tell function to select 1 in whole at Random

characters = "a[email protected]#$%^&*()_+-{}|[]?" # All characters alloted for system. 
vishnu = input()                                                      # Input a Number, How many digits of password you want.....
if (vishnu.isdigit()) and (int(vishnu) != 0):                         # Checking Whether It is number.
    print("This is Password Generator, Your Random strong password at your input range:")
    for _ in range(int(vishnu)):                                      # for in statement Used Here.
        print(random.choice(characters), end="")                      # Telling System to the number of choices, We have....
    print("\n_____________________________________________\n")
    print("UpVote, If you Like the Code🙂")
    print("_____________________________________________")
else:
    print("Enter a Number, Which was Greater than \"0\"")

53. By Supercolbat

Made by Supercolbat. ( Source )

import random
def passwd():
    times = int(input("How letters long do you want your password: "))
    print(times)
    charact = "[email protected]#$%^&*()`-=~_+[];',./\{}:\"<>?|@•√lßšđ₣₤€°^™®©¶¢"
    chars = list(charact)
    passwdstr = ""
    for i in range(times):
        char = random.choice(chars)
        passwdstr += char
    print("Your password is:")
    print(passwdstr)
passwd()

54. By Usama Nadeem

Made by Usama Nadeem. The program generates a random password that has a random length between 9 – 13. ( Source )

import random

#different string literals
s_c = '[email protected]#$%^&*()-+=_{}][|\";:/?.>,</'
numbers = '1234567890'
abc = 'qwertyuioplkjhgfdsazxcvbnm'
ABC = 'ASDFGHJKLPOIUYTREWQZXCVBNM'

#for choosing 
x = random.randint(0,3)

######################
password = ""

#generate random password len
password_length = random.randint(9,13)

#to get the string length
l = 0


#main password generator
while(password_length != 0):
    if x == 0:
        l = len(s_c)-1
        password  += s_c[random.randint(0,l)]
    elif x == 1:
        l = len(numbers)-1
        password  += numbers[random.randint(0,l)]
    elif x == 2:
        l = len(abc)-1
        password  += abc[random.randint(0,l)]
    else:

        l = len(ABC)-1
        password  += ABC[random.randint(0,l)]
    x = random.randint(0,3)
    password_length -= 1

#displaying password
print(f"YOUR PASSWORD IS: {password}")

55. By Dark Killer

Made by Dark Killer. It generates a password containing uppercase characters, lowercase characters, numbers and space. ( Source )

import random
import string
let=list (string.digits)+list (" ")+list (string.ascii_letters)
fin=[]
inp=int (input ())
for i in range (inp):
    wor=random.choice (let)
    add=fin.append (wor)
fin="".join (fin)
print (fin)

56. By Jyoti Kumari

Made by Jyoti Kumari. You will need to enter how many letters, how many numbers and how many symbols you want in the password you want to generate. ( Source )

import random
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 = ['!','#','$','%','&','(',')','*','@']
nr_letters = int(input("Enter how many letters you want: "))
nr_numbers = int(input("Enter how many numbers you want: "))
nr_symbols = int(input("Enter how many symbols you want: "))

password =[]
for char in range(1,nr_letters+1):
  password+=random.choice(letters)
for char in range(1,nr_numbers+1):
  password+=random.choice(numbers)
for char in range(1,nr_symbols+1):
  password+=random.choice(symbols)
random.shuffle(password)
new_password = ""
for char in password:
  new_password+=char

print(f"Your password generated is: {new_password}")

57. By X7|•XSQLS•

Made by X7|•XSQLS•. The program generates a 8 digit password containing only numbers. ( Source )

import random
import time
print("                 \PASSWORD GENERATOR/")
time.sleep(5)
a=random.randint(1,9)
b=random.randint(1,9)
c=random.randint(1,9)
d=random.randint(1,9)
e=random.randint(1,9)
f=random.randint(1,9)
g=random.randint(1,9)
h=random.randint(1,9)
print(a,b,c,d,e,f,g,h)

58. By Gabi_kun :3

Made by Gabi_kun :3. The program generates a random password of random length. ( Source )


# *-* coding: utf-8 *-*

"""
/*
write your preferences here
*/
Options:
    min_length = 5
    max_length = 10
    with_digits = yes
    with_uppercase = yes
    with_lowercase = yes
    with_punctuation = no
"""

from string import (
        digits,
        ascii_uppercase,
        ascii_lowercase,
        punctuation,
        )
from random import choice, randrange
import re
import sys

p_comment = re.compile(r"(/\*(.|\n)*?\*/)")
p_section = re.compile(r"([A-Za-z])+:")
p_option = re.compile(rf"{' ' * 4}([A-Za-z_]+) *= *(\w+)")

def get_doc():
    return __import__(sys.argv[0][:-3]).__doc__

def invalid_doc(doc):
    raise ValueError(f"invalid doc: {doc}")

bools = {"yes": True, "no": False}

def bool_convert(options):
    new = {}
    for opt, value in options.items():
        if bools.get(value) is None:
            new[opt] = value
        else:
            new[opt] = bools[value]
    return new

def int_convert(options):
    new = {}
    for opt, value in options.items():
        if str(value).isnumeric():
            new[opt] = int(value)
        else:
            new[opt] = value
    return new
        

def doc_parser(doc=get_doc()):
    options = {}
    while doc:
        if doc.startswith("\n"):
            doc = doc[1:]
            continue
        com_match = p_comment.match(doc)
        sec_match = p_section.match(doc)
        opt_match = p_option.match(doc)
        if com_match:
            doc = doc[com_match.end():]
            continue
        elif sec_match:
            doc = doc[sec_match.end():]
            continue
        elif opt_match:
            options[opt_match.group(1)] = opt_match.group(2)
            doc = doc[opt_match.end():]
        else:
            invalid_doc(doc)
    return int_convert(bool_convert(options))

def password_gen(**options):
    _options = doc_parser()
    _options.update(options)
    options = _options
    length = randrange(options["min_length"], options["max_length"])
    chars = ""
    if options["with_digits"]:
        chars += digits
    if options["with_uppercase"]:
        chars += ascii_uppercase
    if options["with_lowercase"]:
        chars += ascii_lowercase
    if options["with_punctuation"]:
        chars += punctuation
    password = ""
    while length:
        password += choice(chars)
        length -= 1
    return password


def main():
    password = password_gen()
    print("your password: ")
    print(password)
    return
    

if __name__ == "__main__":
    exit(main()) 

59. By Kasia

Made by Kasia. Simple code to generate a secure password between 12 and 15 characters. ( Source )

import random
import string

def PasswordGenerator():
    length = random.randint(12,15)
    characters = string.ascii_letters + string.digits + string.punctuation
    password = ''
    for i in range(length):
        password += random.choice(characters)
    print(password)
    return password
    
    
"""...........Testing Function.............. """
PasswordGenerator() 

60. By Prakher Srivastava

Made by Prakher Srivastava. The program generates a random 10 digit password. ( Source )

import random
import string


def generatePassword(num):
    password = ''
    for x in range(num):
        x = random.randint(0,99)
        password += string.printable[x]
    return password
    
print (generatePassword(10))

61. By Artur Oleksiński

Made by Artur Oleksiński. Simple Python Password Generator. ( Source )

import random

alpha = ['!','"','#','$','%','&',"'"
        ,'(',')','*','+',',','-','.'
        ,'/','0','1','2','3','4','5'
        ,'6','7','8','9',':',';','<'
        ,'=','>','?','@','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','{'
        ,'|','}','~'
] #94

lenght = int(input('Enter lenght of your password'))
passw = []
password = ''
for i in range(0,lenght):
    change = random.randint(0,93)
    passw.append(alpha[change])
    password += passw[len(passw)-1]

print("Your password: ",password)

62. By Bryan

Made by Bryan. Enter any seed number, symbol or alphabet to generate a random password that is random in length. ( Source )

#This is a protoype.
#Password will consist of four portions(Mod, Num, Root, & Flip)) for added security
#Mod- a randomized string, Flip a number that is generated using thr Num, the `Root- a truncated version of a word input by the user, & Num- a randomly generated number.
import random
import string

 
#Enter a word that has at LEAST 4 letters
print('please enter your root word for password creation\n')
root = input()

#Truncates the root word to only the first 3 letters
root2 = root[0:3]


#Generates a random number value from 1-100
num = random.randint(1,101)
#converts the random number into a string format, since strings can 
#not be concatenated with ints. Num value updated

#flip portion calculated before the num is converted to a string
#formula generates a seemingly non-trivial number that is actually
#related to the original number
flip = int((num / 3) + 1)
num = str(num)
flip = str(flip)


#RandomString Generation
letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' 

def stringGen(length): 
    return ''.join([random.choice(letters) for x in range(0,length)])

#Limits the amount of characters in the mod portion of the password to 4 letters
#Creates mod for input of 4
mod = str(stringGen(4))


#Output
print('Your password is')
print('\n')
password = (mod+flip+root2+num)
print(password)
print('\n')

63. By Webster

Made by Webster. The program generates a random 10 digit password. ( Source )


import random#apart from choice there is random and randint
print(random.choice(("a","b","c","d",1,2,3,4,5,6,7,8,9,0,"#","$","q","w","e","r","t","y","u","i","o","p",
"v","y","x","j","l","m","h","s","g","f")))
print(random.choice(("a","b","c","d",1,2,3,4,5,6,7,8,9,0,"#","$","q","w","e","r","t","y","u","i","o","p",
"v","y","x","j","l","m","h","s","g","f")))
print(random.choice(("a","b","c","d",1,2,3,4,5,6,7,8,9,0,"#","$","q","w","e","r","t","y","u","i","o","p",
"v","y","x","j","l","m","h","s","g","f")))
print(random.choice(("a","b","c","d",1,2,3,4,5,6,7,8,9,0,"#","$","q","w","e","r","t","y","u","i","o","p",
"v","y","x","j","l","m","h","s","g","f")))
print(random.choice(("a","b","c","d",1,2,3,4,5,6,7,8,9,0,"#","$","q","w","e","r","t","y","u","i","o","p",
"v","y","x''","j","l","m","h","s","g","f")))
print(random.choice(("a","b","c","d",1,2,3,4,5,6,7,8,9,0,"#","$","q","w","e","r","t","y","u","i","o","p",
"v","y","x","j","l","m","h","s","g","f")))
print(random.choice(("a","b","c","d",1,2,3,4,5,6,7,8,9,0,"#","$","q","w","e","r","t","y","u","i","o","p",
"v","y","x","j","l","m","h","s","g","f")))
print(random.choice(("a","b","c","d",1,2,3,4,5,6,7,8,9,0,"#","$","q","w","e","r","t","y","u","i","o","p",
"v","y","x","j","l","m","h","s","g","f")))
print(random.choice(("a","b","c","d",1,2,3,4,5,6,7,8,9,0,"#","$","q","w","e","r","t","y","u","i","o","p",
"v","y","x","j","l","m","h","s","g","f")))
 
print(random.choice(("a","b","c","d",1,2,3,4,5,6,7,8,9,0,"#","$","q","w","e","r","t","y","u","i","o","p",
"v","y","x","j","l","m","h","s","g","f")))
#this  is a python module that is used for randomness

64. By Mariya Cor

Made by Mariya Cor. The program generates a random password that is random in length. ( Source )


import random;

symbols = 'qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890-_/@&!?.)(;)'

password = [];
pass_len = random.randrange(8, 15);

i = 0;
while i < pass_len:
	password.append(random.choice(symbols))
	i += 1;

result = ''.join(password);
print("Password:",result);

print("\nI am a beginner programmer!");
print("Please, comment and follow me, thank!");

65. By HonFu

Made by HonFu. Simple pass generator, generates a random password that is 16 digit in length. Source

@;V)LraX6D[8oPjI
print(''.join(__import__('random').sample([chr(i) for i in range(33, 127) if i not in (92, 94, 96)], 16)))

66. By Shah Fahad

Made by Shah Fahad. Generates a 10 digit password. Source

Wn3bt3DMco
import string as s, random as r
p=s.ascii_letters+s.digits+"@#£_&-+()!~$%="
for i in range(10):print(r.choice(p),end="")

67. By Vazgen Gasparyan

Made by Vazgen Gasparyan. Enter password length between 8 – 32 for a random password. Source

Enter 8-32 for length password -  12
password:  0hxt9E-SOD52
from random import sample
from string import ascii_lowercase as al, ascii_uppercase as au

while True:
    length = input('\nEnter 8-32 for length password -  ')
    try:
        while int(length)<8 or int(length)>32:
            length = input('\nInvalid length for password\nPlease enter 8-32 for length password -  ')
    except ValueError: continue
    if int(length)>=8 or int(length)<=32:
        print('password: ', ''.join(sample('_*&!?;:$%^-/.,1234567890'+au+al,int(length))))
        break

68. By sumito_hz

Made by sumito_hz. Source

length: 12

password: I>~J8dL6S%M[

strength: ============
from random import choices
import re

num = int(input())

pw = "".join(map(lambda x: chr(x),choices(range(33,127),k=num)))

def strg(w):
	c1 = bool(re.findall(r"[0-9]",w))
	c2 = bool(re.findall(r"[a-z]",w))
	c3 = bool(re.findall(r"[A-Z]",w))
	c4 = bool(re.findall(r"\W|_",w))
	return (c1+c2+c3+c4)/4
	
strg_i = "="*int(num*strg(pw))

print(f"length: {num}\n")
print(f"password: {pw}\n")
print(f"strength: {strg_i}\n")

69. By Gatila

Made by Gatila. Source

1pmp4jf2
import random
c = ('123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789')
b = ""
i = 1
while len(b)<8:
    i+=1
    a = random.sample(c, random.randint(1, 70))
    if len(a) > i:
        b += a[i]
print(b)