def windChillIndex(windSpeed,temp):
windSpeedInKmH = windSpeed * 3.6
WCI = 1.1626*((5.2735*(windSpeedInKmH**0.5))+10.45-(0.2778*windSpeedInKmH))*(30-temp)
return WCI
windSpeed = []
temp = []
count = 0
while (count<1):
windSpeed.append(float(raw_input("Enter a wind speed in meters per second.")))
temp.append(float(raw_input("Enter a temperature.")))
count += 1
for index1, object in enumerate(windSpeed):
windSpeed[index1] = windChillIndex(object)
out = []
for object in windSpeed:
out.append(windChillIndex(object))
print out
Tags:
有一个内置的!
map
将使用列表之类的iterables项调用函数。两张单子进去,一张单子出来。你知道吗您是否尝试迭代两个风速值和温度值列表,并生成一个新的风寒值列表?你知道吗
如果是这样,您应该使用内置的
zip
函数。这将获取两个列表并一起迭代,为您提供指向每个值的指针。你知道吗相关问题 更多 >
编程相关推荐