Check a user name and PIN code : Member in « List « Python Tutorial






database = [
    ['a',  '1234'],
    ['b',  '4242'],
    ['c',  '7524'],
    ['d',  '9843']
]

username = 'albert'
pin = '1234'

if [username, pin] in database: print 'Access granted'








7.18.Member in
7.18.1.Check a user name and PIN code
7.18.2.All items
7.18.3.For each item in a list
7.18.4.Membership ( in, not in )