阳台上的植物记在一个字典里:{植物: 几天没浇水}。写 thirsty_plants(days),返回 3 天或更久没浇水的植物,按字典里的顺序排。都不用浇就返回 []。
thirsty_plants({"fern": 4, "cactus": 10, "mint": 1})→['fern', 'cactus']thirsty_plants({})→[]def thirsty_plants(days):
thirsty = []
# 在这里写:用 items() 走一遍,天数够 3 就把植物放进 thirsty
return thirsty
写好了先点「运行」试试示例,没问题再点「提交」。