First password generator in Python
letters = [&quot;a&quot;, &quot;b&quot;, &quot;c&quot;, &quot;d&quot;, &quot;e&quot;, &quot;f&quot;, &quot;g&quot;, &quot;h&quot;, &quot;i&quot;, &quot;j&quot;, &quot;k&quot;, &quot;l&quot;, &quot;m&quot;, &quot;n&quot;, &quot;o&quot;, &quot;p&quot;, &quot;q&quot;, &quot;r&quot;, &quot;s&quot;, &quot;t&quot;, &quot;u&quot;,`
           &quot;v&quot;, &quot;w&quot;, &quot;x&quot;, &quot;y&quot;, &quot;z&quot;]


This method of writing the alphabet is very error prone. I would import string and use string.ascii_lowercase in place of letters. If you want to generate your own range of letters for whatever reason, I would write
letters = [chr(n) for n in range(ord('a'), ord('z') + 1)]

since there's then no danger of omitting or duplicating a letter.


password_length = 0
password_numbers = []
password_letters = []


These default values are never used. The defaults for password_numbers and password_letters don't make sense since those variables hold numbers. I would delete all three lines.


if not password_length_input.isnumeric():
    print(f&quot;{password_length_input} is not a number, try again:&quot;)
    continue
else:
    password_length = int(password_length_input)
    print(f&quot;Password length: {password_length}&quot;)


I would instead write
try:
    password_length = int(password_length_input)
except ValueError:
    print(f&quot;{password_length_input} is not a number, try again:&quot;)
    continue
print(f&quot;Password length: {password_length}&quot;)



while True:
    if password_numbers == password_length:
        ...
        break
    else:
        ...
        break


There is no sense in having a while loop here since you always break out of it on the first iteration.


range(0,password_numbers)


You can just write range(password_numbers).


password.append(random.randrange(0,9))


This will append a digit from 0 to 8 inclusive, never 9. If you want all ten digits you should write random.randrange(10). Or, perhaps better, use random.choice(string.digits).


password_string = ''.join([str(item) for item in password])


If you use string.digits then every element of password will be a character so you can simplify this to password_string = ''.join(password).