Python无效语法错误
选择 | 换行 | 行号
- def main():
- months = ["January","Feburary","March","April","May","June","July","August","September","October","November","December"]
- SIZE = 12
- rainForMonth = [] * SIZE
- index,subNumHigh,subNumLow = 0,0,0
- yearTotal, yearAverage, monthHighest, monthLowest = 0.0,0.0,0.0,0.0
- for index in range(SIZE):
- print "Enter the amount of rainfall for the month of", months[index]
- rainForMonth = float(raw_input(("Enter here: "))
- yearTotal = arraySum(rainForMonth,SIZE)
- yearAverage = yearTotal / SIZE
- monthHighest, subNumHigh = arrayHighestValue(rainForMonth,SIZE)
- monthLowest, subNumLow = arrayLowestValue(rainForMonth,SIZE)
- print "Here are the results!"
- print "Amount of rainfull for the year:", yearTotal
- print "Average rainfall for the year:", yearAverage
- print monthHighest, "had the most rainfall."
- print monthLowest, "had the least rainfall."
问题出在第14行。我尝试运行该程序,它突出显示了第14行中的totalYear变量,表示它是一个无效语法。我觉得没什么不对。更新****我只需要把第12行的括号修好。