Skip to content

Instantly share code, notes, and snippets.

@Sangram92
Last active February 6, 2016 10:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sangram92/9cef6889b215d1774362 to your computer and use it in GitHub Desktop.
Save Sangram92/9cef6889b215d1774362 to your computer and use it in GitHub Desktop.
import random
import string
from random import randint
def simple_password(count):
password = ''.join(random.choice(string.letters) for x in range(count))
return password
def medium_strong_password():
letter = simple_password(6)
rand_int = ''.join(str((randint(0,9)))for x in range(2))
password = letter + rand_int
return password
def strong_password():
letter_and_int = medium_strong_password()
special_char = ''.join((random.choice('#$%&*'))for x in range(2))
password = letter_and_int + special_char
return password
choice = raw_input("Enter Password Difficulty Level : \n 1.Simple Password\n 2.Medium Strong Password\n 3.Strong Password\n")
if choice == "1":
print simple_password(8)
elif choice == "2":
print medium_strong_password()
elif choice == "3":
print strong_password()
else:
print"Enter valid choice"
# def check_password(password):
# check_pass = raw_input("Enter Password")
# if check_pass == password:
# print"Correct Password"
# else:
# print"Invalide Password"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment