DEV Community

Cover image for Day 9: Password Generator
Matt Ryan
Matt Ryan

Posted on

Day 9: Password Generator

A password generator that asks the user how many passwords to generate and at what length.

#!/bin/python3

import random

print('''
Password Generator
==================
''')

chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@£$%^&*().,?0123456789'

number = input('number of passwords?')
number = int(number)

length = input('password length?')
length = int(length)

print('\nhere are your passwords:')

for pwd in range(number):
  password = ''
  for c in range(length):
    password += random.choice(chars)
  print(password)
Enter fullscreen mode Exit fullscreen mode

Top comments (0)