Password Generator (Python)

Hello,

I am trying to create a password generator, randomly generating a combination of letters (upper and lowercase), numbers, and symbols up to 10 characters. Could someone help me understand why I am getting nothing when I run my code? Thanks!

#importing
import random
import string

#gather all characters
letters_upper = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
letters_lower = letters_upper.lower()
numbers = '0123456789'
symbols = string.punctuation

#combine all into one single variable for iteration
all = letters_lower + letters_upper + numbers + symbols

#create password
def password_create():
    password = ''
    while len(password) < 11:
        password += random.choice(all)
    return password

password_create()

I think you just need to print the result so you can see the output like this:

print(password_create())

3 Likes