Advertisement
Guest User

Untitled

a guest
Nov 3rd, 2016
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. #Simulating make array from visual logic with named constants
  2. #Declarations
  3. userName = "bob"
  4. userPass = "robert"
  5. foundFlag = 0
  6. authFlag = 0
  7. inputName = " "
  8. inputPass = " "
  9. attempts = 5
  10.  
  11. #modulels
  12. def getName():
  13. global inputName
  14. global foundFlag
  15. global userName
  16. while foundFlag == 0:
  17. inputName = input(str("Please enter your user name: "))
  18. if inputName == userName:
  19. foundFlag = 1
  20. else:
  21. print("Incorrect user name, try again.")
  22. foundFlag = 0
  23. def getPass():
  24. global userPass
  25. global authFlag
  26. global inputPass
  27. global attempts
  28. while authFlag == 0:
  29. inputPass = input(str("Please enter your password: "))
  30. if inputPass == userPass:
  31. print("Access granted!")
  32. authFlag = 1
  33. else:
  34. print("Wrong password, you have ",attempts, " more attempts.")
  35. authflag = 0
  36. attempts = attempts - 1
  37. if attempts == 0:
  38. print("Out of attempts - exiting.")
  39. authflag = 2
  40.  
  41. #logic
  42. getName()
  43. getPass()
  44. if authFlag == 1:
  45. print("Senisitive information goes here")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement