+ 1
Hello solo geeks, need little help about this assignment.
i am trying to create a list that will hold all the possible random generated password. i took so many failed attempt after created the password_holder empty list on line 8, anybody has any thought pls share with me ``` import random import string letters = string.ascii_letters + string.digits + string.punctuation combinations = [''.join(random.choices(letters, k= 15))] passwords_holder = [] ```
2 ответов
+ 4
There are 94 elements in 'letters'. If you want to find every 15 letter combination and store it in a list, you'll need ~ 6 million 2 TB hard drives to store that list.
The 'combinations' variable will only hold one single 15 letter combination. You don't really need it.
You could use a list comprehension to generate a couple of combinations:
passwords_holder = [''.join(random.choices(letters, k=15)) for i in range(5)] # this will fill the list with 5 passwords
+ 1
I wish you are my mentor Anna.