Skip to content

Instantly share code, notes, and snippets.

@dumpmycode
Last active August 13, 2016 04:41
Show Gist options
  • Save dumpmycode/14fc52384c0d1e92f9c3 to your computer and use it in GitHub Desktop.
Save dumpmycode/14fc52384c0d1e92f9c3 to your computer and use it in GitHub Desktop.
practicepython.org - password generator
#! /usr/bin/env python
# author: oscarp
# practicepython.org password generator
import random
import string
def pwgen(pwlen):
box = string.ascii_letters + '][?/<~\#`!@$%^&*()+=}|:";\',>{'
return (''.join(random.sample(box, pwlen)))
an = raw_input('Do you want to generate new password? (y/n)')
while an != 'n':
n = int(raw_input('enter password length (over 8 characters is recommended): '))
print('Your new password is: "{}"'.format(pwgen(n)))
an = raw_input('Do you want to generate new password again? (y/n)')
print('Thank you for using our super sophisticated fort knox level password generator okm8.')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment