Last active
February 6, 2016 10:02
-
-
Save Sangram92/9cef6889b215d1774362 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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