Python无效语法错误

选择 | 换行 | 行号
  1. def main():
  2.  
  3.     months = ["January","Feburary","March","April","May","June","July","August","September","October","November","December"]
  4.  
  5.     SIZE = 12
  6.     rainForMonth = [] * SIZE
  7.     index,subNumHigh,subNumLow = 0,0,0
  8.     yearTotal, yearAverage, monthHighest, monthLowest = 0.0,0.0,0.0,0.0
  9.  
  10.     for index in range(SIZE):
  11.         print "Enter the amount of rainfall for the month of", months[index]
  12.         rainForMonth = float(raw_input(("Enter here: "))
  13.  
  14.     yearTotal = arraySum(rainForMonth,SIZE)
  15.     yearAverage = yearTotal / SIZE
  16.     monthHighest, subNumHigh = arrayHighestValue(rainForMonth,SIZE)
  17.     monthLowest, subNumLow = arrayLowestValue(rainForMonth,SIZE)
  18.  
  19.     print "Here are the results!"
  20.     print "Amount of rainfull for the year:", yearTotal
  21.     print "Average rainfall for the year:", yearAverage
  22.     print monthHighest, "had the most rainfall."
  23.     print monthLowest, "had the least rainfall."
  24.  

问题出在第14行。我尝试运行该程序,它突出显示了第14行中的totalYear变量,表示它是一个无效语法。我觉得没什么不对。更新****我只需要把第12行的括号修好。

# 回答1

但错误并不一定存在。第12行有不匹配的括号。

标签: python

添加新评论