字典的简单练习题1
list1 = [11,22,33,44,55,66,77,88,99,100]
#所有大于66的值放到第一个key里,所有小于66的值放到第二个key里
dic = {}
for i in list1:
if i < 66:
if 'k1' in dic.keys():
dic['k1'].append(i)
else:
dic['k1']= [i, ]
else:
if 'k2' in dic.keys():
dic['k2'].append(i)
else:
dic['k2']= [i, ]
print(dic)