color 圖片 .com 技術 gre code com pri print

#-*-coding:utf-8-*-
‘‘‘

‘‘‘
li = [11,22,33,44,55,66,77,88,99]
dic = {}
l_greater = []
l_smaller = []
for i in li:
    if i ==66:
        continue
    if i>66:
        l_greater.append(i)
    else:
        l_smaller.append(i)
print(l_greater)
print(l_smaller)
# 放到字典裏
dic.setdefault(k1,l_smaller)
dic.setdefault(k2,l_greater)
print(dic)

技術分享圖片

Python(39)_選出列表中的大於66的數字放在字典中