Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from sys import *
- from string import *
- password = input(
- """
- Please enter your password.
- Passwords must be more than 10 characters long,
- But less than 20 characters long.
- include both upper and lower case letters
- and atleast 1 special character.
- password can contain no spaces.
- type password here:""")
- lwr_let = list(ascii_lowercase)
- upr_let = list(ascii_uppercase)
- nums = list(digits)
- spcs = list(punctuation)
- lwr_let_count = 0
- upr_let_count = 0
- nums_count = 0
- spcs_count = 0
- if len(password) < 10 or len(password) > 20:
- exit("Password length not met, try again")
- for i in password:
- if i in lwr_let:
- lwr_let_count += 1
- elif i in upr_let:
- upr_let_count += 1
- elif i in nums:
- nums_count += 1
- elif i in spcs:
- spcs_count += 1
- elif i == " ":
- exit("spaces are not allowed. Please try again.")
- else:
- exit("One of your characters is not allowed. Please try again.")
- if lwr_let_count == 0:
- exit("No lowercase letters detected, try again")
- if upr_let_count == 0:
- exit("No uppercase letters detected, try again")
- if nums_count == 0:
- exit("No numbers detected, try again")
- if spcs_count == 0:
- exit("No special characters detected, try again")
- print("password setup complete. Password is %s" % (password))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement