Advertisement
Guest User

Untitled

a guest
Jun 2nd, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.12 KB | None | 0 0
  1. #TimCorkindale
  2. #This program will generate a username from your first and last name and you student id number, it will also test the strength of your password
  3. print "This program will create a username for you and test your password strength"
  4. print ("")
  5. def username ():
  6.     print "     Username Creator        "
  7.     first=raw_input ("please type your first name:")
  8.     last=raw_input  ("please type your last name:")
  9.     idn=raw_input ("please type your student id number:")
  10.     fname = first[:3]
  11.     lname = last[:3]
  12.     iidn = idn[-3:]
  13.     preuser = [fname,lname,iidn]
  14.     username = "".join(preuser)
  15.     print "your username is :",username
  16.     print ("")
  17. def passwordtest ():
  18.     print "             Password Checker                "
  19.     print "this will check the strength of your password"
  20.     print ("")
  21.     print "your password must meet these requirements"
  22.     print ("")
  23.     print "* be at least 7 characters long"
  24.     print "* contain at least 1 uppercase letter"
  25.     print "* contain at least 1 lowercase letter"
  26.     print "* contain at least 1 numeric digit"
  27.     passtrth=0
  28.     while passtrth <= 2:
  29.         password=raw_input ("Please type a password that meets the requirements:")
  30.         upperl=0
  31.         lowerl=0
  32.         digitn=0
  33.         for upper in password:
  34.             if upper.isupper():
  35.                 upperl += 1
  36.         for lower in password:
  37.             if lower.islower():
  38.                 lowerl += 1
  39.         for digit in password:
  40.             if digit.isdigit():
  41.                 digitn += 1
  42.         if len(password) <6 or lowerl ==0 or upperl ==0 or digitn ==0:
  43.             print "your password does not meet the requrments"
  44.         else:
  45.             passtrth = 3
  46.             print "your password meets the requrments "
  47. playagain = "y"
  48. while playagain == "y" or "Y":            
  49.     username()
  50.     passwordtest()
  51.     playagain=raw_input ("would you like to play again Y/N :")
  52.     if playagain == "N" or "n":
  53.         import time
  54.         print "Thank you for using username creator and password checker"
  55.         time.sleep(5)
  56.         quit()
  57.     else:
  58.         print "Rerunning Program"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement