可以用做登录操作,判断用户名密码是否正确!

代码示例:

database = [
    ['albert','1234'],
    ['dilbert','4242'],
    ['smith','7524'],
    ['jones','9843']
]
username = input("UserName: ")
pin = input("PIN Code: ")
if [username,pin] in database:
    print("Access granted")
else:
    print("Access Refused")
    exit()

输出:

UserName: albert
PIN Code: 1234
Access granted

Process finished with exit code 0

 

UserName: albert
PIN Code: 2345
Access Refused

Process finished with exit code 0

 

相关文章:

  • 2021-09-21
  • 2021-10-30
  • 2022-12-23
  • 2021-11-09
  • 2021-08-22
  • 2021-11-07
  • 2022-02-08
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-24
  • 2021-09-16
  • 2022-02-09
  • 2021-10-11
相关资源
相似解决方案