阳台上的花怕冷。列表里是这些天晚上的温度。写 cold_nights(temps, limit),返回有几晚的温度比 limit 低(正好等于不算)。
cold_nights([3, -1, 5, -4, 0], 0)→2cold_nights([8, 9, 10], 5)→0def cold_nights(temps, limit):
count = 0
for t in temps:
# 在这里写:比 limit 低,count 就加 1
pass
return count
写好了先点「运行」试试示例,没问题再点「提交」。