# Password.py
#
# Create a secure password
#
import random
charset = 'ABCDEFGHJKLMNPQRSTUVWXZYabcdefghjklmnpqrstuvwxyz23456789_$#@!'
length = input("How many characters in your new password? ")
length = int(length)
def random_char():
return charset[random.randrange(len(charset))]
def random_password(n):
password = ''
for x in range(n):
password += random_char()
return password
print("Your new password is", random_password(length))