Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #login-password.py ===============================/*
- # N2 - Programming Python! ==/*
- # Example Basic For NewbiE! ==/*
- # Using if/else, lists, assignments, def input==/*
- #=================================================/*
- #Assign username and password;
- userName = ['lequyet','tanphat','baohuy','vananh','kietpham']
- passWord = ['123','321','456','654','789']
- #Get the username and password;
- usrname = input("Enter your username: ")
- pssword = input("Enter your password: ")
- #------------------------------------------/*
- #Process assign and get username/password--/*
- # Check to see if user is in the list --/*
- #------------------------------------------/*
- if usrname in userName:
- position = userName.index(usrname)
- if pssword == passWord[position]:
- print("Hi there, %s. Access granted." % usrname)
- else:
- print("Password incorrect. Access denied")
- else:
- print("Sorry... i don't recognize you! Access denied")
Add Comment
Please, Sign In to add comment