字典实战应用,笨方法学python

#coding=utf-8

#creat a mapping from child to account_name

children = {
    'Hannibal': 'Des001',
    'Shmily': 'Angel136',
    'James': 'Feng128',
    'Jayden': 'Luo125',
}

#Creat a basic set of account and passwords
accounts = {
    'Des001': 'Hannibal01',
    'Angel136':'Shmily01',
    'Feng128': 'James01',
    'Luo125': 'Jayden01',
}

print "Please input children\'s name:"

next = raw_input(">")

print " the %s account information is: %s, and the pw is %s" % (next, children[next], accounts[children[next]])

你可能感兴趣的:(python)