6-1 人
person = {
'first_name': 'william',
'last_name': 'cliton',
'age': 20,
'city': 'new york',
}
print(person)
6-2 喜欢的数字
love_numbers = {
'ford': 4,
'david': 6,
'louis': 7,
'sam':1,
'bob':7,
}
print(love_numbers)
6-3 词汇表
python_lists = {
'append': '将元素添加到列表末尾',
'insert': '可在列表的任何位置添加新元素',
'pop': '删除列表末尾的元素',
'remove': '根据值删除元素',
'sort': '对列表进行永久性排序',
}
print("append:" + python_lists['append'])
print("insert:" + python_lists['insert'])
print("pop:" + python_lists['pop'])
print("remove:" + python_lists['remove'])
print("sort:" + python_lists['sort'])
print("\n")
print("append" +"\t" + "insert" + "\t" + "pop" + "\t" + "remove" + "\t" +
"sort")
print("\n")
print(python_lists['append']+'\t'+
python_lists['insert'] + '\t' +
python_lists['pop'] + '\t' +
python_lists['remove'] + '\t' +
python_lists['sort'])
6-3 词汇表
python_lists = {
'append': '将元素添加到列表末尾',
'insert': '可在列表的任何位置添加新元素',
'pop': '删除列表末尾的元素',
'remove': '根据值删除元素',
'sort': '对列表进行永久性排序',
}
print("append:" + python_lists['append'])
print("insert:" + python_lists['insert'])
print("pop:" + python_lists['pop'])
print("remove:" + python_lists['remove'])
print("sort:" + python_lists['sort'])
print("\n")
print("append\n")
print('\t' + python_lists['append'])
print('insert\n')
print('\t' + python_lists['insert'])
print('pop\n')
print('\t' + python_lists['pop'])
print('remove\n')
print('\t' + python_lists['remove'])
print('sort\n')
print('\t' + python_lists['sort'])