Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Simulating make array from visual logic with named constants
- #Declarations
- userName = "bob"
- userPass = "robert"
- foundFlag = 0
- authFlag = 0
- inputName = " "
- inputPass = " "
- attempts = 5
- #modulels
- def getName():
- global inputName
- global foundFlag
- global userName
- while foundFlag == 0:
- inputName = input(str("Please enter your user name: "))
- if inputName == userName:
- foundFlag = 1
- else:
- print("Incorrect user name, try again.")
- foundFlag = 0
- def getPass():
- global userPass
- global authFlag
- global inputPass
- global attempts
- while authFlag == 0:
- inputPass = input(str("Please enter your password: "))
- if inputPass == userPass:
- print("Access granted!")
- authFlag = 1
- else:
- print("Wrong password, you have ",attempts, " more attempts.")
- authflag = 0
- attempts = attempts - 1
- if attempts == 0:
- print("Out of attempts - exiting.")
- authflag = 2
- #logic
- getName()
- getPass()
- if authFlag == 1:
- print("Senisitive information goes here")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement