DEV Community

sngvfx
sngvfx

Posted on

Simple Password Generator

Here is a simple python generator that use the "Random" module with a random.sample() method. The generated password is a combination of upper and lowercase letters, numbers and symbols. To make the password more complex and not easy to hack, the length of the password has been set to 20.

Give it a try, feel free to improve it and let me know!

Image description

Top comments (2)

Collapse
 
_bkeren profile image
'' • Edited
  1. this should be function, password length as parameter
  2. linked looks long, but it's actually combination of 4 groups. To increment randomness, for each step in length, pick a random char from randomly chosen group, not from linked.
Collapse
 
sngvfx profile image
sngvfx

You are absolutely right, I actually have a much more advanced version of this code and I used the functions. However in the newer version I have the *password_length * as an input function to allow users to enter whatever length / characters they want (between 12 and 20)...

Let me try the randomness part, that a good idea too.