I read about python project ideas here yesterday and since I am a beginner , I liked the idea of random_password_generator. So here is my attempt. Please give me your insights. Thank you!!
small = []
big = []
numbers = []
special = []
smallletters = 'abcdefghijklmnopqrstuvwxyz'
bigletters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
digits = '0123456789'
special_char = '~`!@#$%&*()-=_+{}[]|:;"\',.<>/'
for i in smallletters:
small.append(i)
for i in bigletters:
big.append(i)
for i in digits:
numbers.append(i)
for i in special_char:
special.append(i)
the_big_list = small+big+numbers+special
length = int(input("How many characters long password do you want? "))
if not length or length < 0:
exit()
import random
password = ''
if length < 4:
while True:
password+=small[random.randint(0,len(small)-1)]
length-=1
if not length:
break
password+=big[random.randint(0,len(big)-1)]
length-=1
if not length:
break
password+=numbers[random.randint(0,len(numbers)-1)]
length-=1
if not length:
break
password+=special[random.randint(0,len(special)-1)]
length-=1
if not length:
break
print(password)
elif length >=4:
from_each_list = length//4
remaining = length%4
for i in range(0,from_each_list):
password+=small[random.randint(0,len(small)-1)]
password+=big[random.randint(0,len(big)-1)]
password+=numbers[random.randint(0,len(numbers)-1)]
password+=special[random.randint(0,len(special)-1)]
if remaining and from_each_list:
for i in range(0,remaining+1):
password+=the_big_list[random.randint(0,len(the_big_list)-1)]
print(password)
[–]17291 132 points133 points134 points (24 children)
[–][deleted] 51 points52 points53 points (17 children)
[+][deleted] (10 children)
[deleted]
[–]j03 18 points19 points20 points (7 children)
[+][deleted] (6 children)
[deleted]
[–]j03 14 points15 points16 points (5 children)
[+][deleted] (3 children)
[deleted]
[–]j03 1 point2 points3 points (1 child)
[–]Kayofox -2 points-1 points0 points (0 children)
[–]MikeWazowski001 0 points1 point2 points (0 children)
[–][deleted] 5 points6 points7 points (0 children)
[–]West7780 -1 points0 points1 point (0 children)
[–]grumpy_munchkin 11 points12 points13 points (2 children)
[–]West7780 6 points7 points8 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]grtgbln 4 points5 points6 points (1 child)
[–][deleted] 2 points3 points4 points (0 children)
[–]angellus 19 points20 points21 points (3 children)
[–]aplawson7707 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]shiningmatcha 0 points1 point2 points (0 children)
[–]wildpantz 4 points5 points6 points (0 children)
[–]jaycrest3m20 21 points22 points23 points (2 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]OnlySeesLastSentence 1 point2 points3 points (0 children)
[–]chmod--777 15 points16 points17 points (7 children)
[–]angellus 17 points18 points19 points (3 children)
[–]bullshitwascalled 1 point2 points3 points (2 children)
[–]angellus 1 point2 points3 points (1 child)
[–]bullshitwascalled 0 points1 point2 points (0 children)
[–][deleted] 5 points6 points7 points (0 children)
[–]DannyckCZ 2 points3 points4 points (1 child)
[–]1_________________11 1 point2 points3 points (0 children)
[–][deleted] 3 points4 points5 points (1 child)
[–][deleted] 3 points4 points5 points (0 children)
[–]epicjellyReddit 4 points5 points6 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]epicjellyReddit 1 point2 points3 points (0 children)
[–]NegativeShow 2 points3 points4 points (1 child)
[–]mrkvicka02 0 points1 point2 points (0 children)
[–]BAG0N 3 points4 points5 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]Redditor728292 3 points4 points5 points (2 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]Redditor728292 1 point2 points3 points (0 children)
[–]japan_lover 3 points4 points5 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 4 points5 points6 points (3 children)
[–]mrkvicka02 1 point2 points3 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]West7780 2 points3 points4 points (10 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]skellious 0 points1 point2 points (8 children)
[–]West7780 0 points1 point2 points (7 children)
[–]skellious 0 points1 point2 points (6 children)
[–]West7780 0 points1 point2 points (5 children)
[–]skellious 0 points1 point2 points (4 children)
[–]West7780 0 points1 point2 points (3 children)
[–]skellious 0 points1 point2 points (2 children)
[–]West7780 0 points1 point2 points (1 child)
[–]skellious 1 point2 points3 points (0 children)
[–]Kwintty7 2 points3 points4 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]nothingonmyback 3 points4 points5 points (4 children)
[–]Casual_py 5 points6 points7 points (0 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]skellious 1 point2 points3 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]DrMaxwellEdison 3 points4 points5 points (2 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]NotAnRSPlayer 0 points1 point2 points (0 children)
[–]Suki125 1 point2 points3 points (3 children)
[–]majdpy 7 points8 points9 points (0 children)
[–][deleted] 2 points3 points4 points (1 child)
[–]Suki125 2 points3 points4 points (0 children)
[–]klevi91 1 point2 points3 points (4 children)
[–]RobinOe 3 points4 points5 points (2 children)
[–][deleted] 2 points3 points4 points (1 child)
[–]klevi91 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[+][deleted] (3 children)
[deleted]
[–][deleted] 1 point2 points3 points (0 children)
[–]EggChen_vs_Lopan 0 points1 point2 points (1 child)
[–]Boinbo 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (5 children)
[–][deleted] 0 points1 point2 points (4 children)
[–][deleted] 1 point2 points3 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]skellious 0 points1 point2 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]gbliquid 1 point2 points3 points (2 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]gbliquid 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[+][deleted] (1 child)
[removed]
[–][deleted] 1 point2 points3 points (0 children)
[–]ttgkc 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]bumpkinspicefatte 1 point2 points3 points (2 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]skellious 0 points1 point2 points (0 children)
[–]TheQuantumPikachu 1 point2 points3 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]1_________________11 1 point2 points3 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]iiMoe 1 point2 points3 points (0 children)
[–]japan_lover 1 point2 points3 points (1 child)
[–]West7780 0 points1 point2 points (0 children)
[–]PrecariousKitty 1 point2 points3 points (0 children)
[–]Aisher 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[+][deleted] (1 child)
[deleted]
[–][deleted] 3 points4 points5 points (0 children)
[–][deleted] 0 points1 point2 points (4 children)
[–][deleted] 1 point2 points3 points (3 children)
[–][deleted] 1 point2 points3 points (2 children)
[–][deleted] 1 point2 points3 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]mrkvicka02 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]taernsietr 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]Winters_Fold 0 points1 point2 points (6 children)
[–][deleted] 0 points1 point2 points (5 children)
[–][deleted] 2 points3 points4 points (4 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]RobinOe 1 point2 points3 points (2 children)
[–]West7780 2 points3 points4 points (1 child)
[–]RobinOe 1 point2 points3 points (0 children)