Password Generator | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Password Generator

https://code.sololearn.com/c6WC3Bys9bzG/?ref=app Anyone can explain to me how does this works? I've recently finished learning python but now I feel like I don't know anything lol

26th Feb 2019, 2:56 AM
thariq
thariq - avatar
2 Answers
+ 2
Python’s random module has a function called sample. Sample takes two inputs, in this case, a string of characters and the amount of times you want it to get a random character from that string. The "".join() takes that list and joins each item together into one string with no delimeter so that it becomes one “word”, and there you have a password made randomly from the character string “x”!
26th Feb 2019, 3:06 AM
Nathan Lewis
Nathan Lewis - avatar
0
Now I get it. Thank you for your help :)
26th Feb 2019, 3:08 AM
thariq
thariq - avatar