def main():
NUMBER_OF_DAYS = 10
NUMBER_OF_HOURS = 24
data = []
for i in range(NUMBER_OF_DAYS):
data.append([])
for j in range(NUMBER_OF_HOURS):
data[i].append([])
data[i][j].append(0)
data[i][j].append(0)
for k in range(NUMBER_OF_DAYS * NUMBER_OF_HOURS):
line = input().strip().split()
day = eval(line[0])
hour = eval(line[1])
temperature = eval(line[2])
humidity = eval(line[3])
data[day - 1][hour - 1][0] = temperature
data[day - 1][hour - 1][1] = humidity
for i in range(NUMBER_OF_DAYS):
dailyTemperatureTotal = 0
dailyHumidityTotal = 0
for j in range(NUMBER_OF_DAYS):
dailyTemperatureTotal += data[i][j][0]
dailyHumidityTotal += data[i][j][1]
print("Day " + str(i) + "'s average temperature is" + str(dailyTemperatureTotal / NUMBER_OF_HOURS))
print("Day " + str(i) + "'s average humidity is" + str(dailyHumidityTotal / NUMBER_OF_HOURS))
main()
好吧,这让我很紧张。由于我面临的另一个错误,我似乎无法运行此代码。解析时这个 EOF 是什么。由于某种原因,它似乎突出显示day = eval (line[0])
,我不知道为什么