天气预报给了这周每天的最高温 temps。写 heat_alert(temps):只要有一天超过 35 度,就返回 True;一天都没有(或者列表是空的)返回 False。
temps
heat_alert(temps)
True
False
heat_alert([30, 33, 37, 31])
heat_alert([28, 30, 35])
def heat_alert(temps): for t in temps: # 在这里写:超过 35 度,马上返回 True pass return False
写好了先点「运行」试试示例,没问题再点「提交」。
这一页要打开 JavaScript 才能写代码。