为什么错了?我以前运行过它,但由于某种原因,现在它不运行了。这很简单,我是一个初学者,所以我很难弄清楚。你知道吗
def checkTemp(x):
if x == 0:
return 0
elif x > 32:
return 'above'
elif x == 32:
return 'freezing'
elif x < 32:
return 'below'
def aboveBelowFreeze(tempList):
'''
Given a list of temperatures, return a list of strings
that say 'above', 'below', or 'freezing', depending
on whether the temperature was above 32, below 32, or
equal to 32. Create a helper function if you need it.
'''
return ([checkTemp(x) for x in tempList])
只要您使用列表输入调用上下冻结函数,它就可以正常工作。在没有缩进的函数之外有这样的东西:
相关问题 更多 >
编程相关推荐