Guest User

Untitled

a guest
Mar 19th, 2018
568
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. #login-password.py ===============================/*
  2. # N2 - Programming Python! ==/*
  3. # Example Basic For NewbiE! ==/*
  4. # Using if/else, lists, assignments, def input==/*
  5. #=================================================/*
  6. #Assign username and password;
  7. userName = ['lequyet','tanphat','baohuy','vananh','kietpham']
  8. passWord = ['123','321','456','654','789']
  9. #Get the username and password;
  10. usrname = input("Enter your username: ")
  11. pssword = input("Enter your password: ")
  12. #------------------------------------------/*
  13. #Process assign and get username/password--/*
  14. # Check to see if user is in the list --/*
  15. #------------------------------------------/*
  16. if usrname in userName:
  17. position = userName.index(usrname)
  18. if pssword == passWord[position]:
  19. print("Hi there, %s. Access granted." % usrname)
  20. else:
  21. print("Password incorrect. Access denied")
  22. else:
  23. print("Sorry... i don't recognize you! Access denied")
Add Comment
Please, Sign In to add comment