I'm trying to create a password generator and I want it to generate a password that has to include letters, numbers and symbols. But, when I ask for an input it would input (e.g 9) it would generate 9 letters, symbols and numbers. And if I just put all the letters, numbers and symbols in one string, it's not guaranteed to include symbols or numbers.
Help/Feedback is appreciated.
So, since you have 3 different possible character sets to choose from, I made a simple
r variable that makes a random choice between 1 and 3, and picks a character from a character set based on that choice.
I made a fork of your repl, with the modifications I listed above, you can look at: https://repl.it/@heyitsmarcus/Password-Generator
import random print ("""This is my simple password generator.""") letters = "abcdefghijklmnopqrstuvwxyz" symbols = "[email protected]#[email protected]*" numbers = "123456789" length = int(input("How long do you want your password? ")) password = "" for c in range(length): r = random.randint(1,3) if (r == 1): password += random.choice(letters) elif (r == 2): password += random.choice(symbols) elif (r == 3): password += random.choice(numbers) print (password)