# coding:utf-8
# 111111111111111快速生成
# 快速生成字典
a= dict(zip("abcd", range(4)))
print(a)
# 按照条件快速输出
b= 11
print("ok" if b== 1 else "ko")
# 2222222222222快速排序
# 快速输出前几名
import heapq
nums= [1, 2, 3, 4, 56, 77, 88, 99]
print(heapq.nlargest(3, nums)) # 最大的前三名
print(heapq.nsmallest(3, nums)) # 最小的前三名
students= [{"name": "aa", "age": 15, "score": 100},
{"name": "bb", "age": 16, "score": 90},
{"name": "cc", "age": 17, "score": 80}
]
# 按照某个key排序
print(heapq.nsmallest(2, students, key=lambda z: z["age"]))