摘要:
from random import randint #找出出现次数最多的前3个 data = [randint(0,20) for _ in range(30)] print(data) d = dict.fromkeys(data,1) print(d) for x in data: d[x] += 1 dd = sorted([(v,k) for k,v in d.items(... 阅读全文
摘要:
from random import randint # print(randint(-10,10)) # # l = [randint(-10,10) for i in range(10)] # # print( [x for x in l if x >= 0] ) # # print(list(filter(lambda x:x>=0,l))) mcase = {'a': 10, 'b'... 阅读全文