It Won't Let Me Pass, What Am I Supposed to Do?


#1

Question : We’re trying to figure out how much it rained in the past year! Update the annual_rainfall variable to include the values from September to December.

My answer:

january_rainfall = 1.20
febuary_rainfall = 3.74
march_rainfall = 1.64
april_rainfall = 4.22
may_rainfall = 3.15
june_rainfall = 1.58
july_rainfall = 4.39
august_rainfall = 2.16
september_rainfall = 3.14
october_rainfall = 2.03
november_rainfall = 2.15
december_rainfall = 2.87

annual_rainfall = january_rainfall + febuary_rainfall + march_rainfall + april_rainfall + may_rainfall + june_rainfall + july_rainfall + august_rainfall

annual_rainfall += september_rainfall
annual_rainfall += october_rainfall
annual_rainfall += november_rainfall
annual_rainfall += december_rainfall

print annual_rainfall

is there any mistake? it don’t let me pass and showing “Did you add all of the remaining months to the variable annual_rainfall?”. what am I suppose to do?


FAQ: Learn Python - Python Syntax - Updating Variables
#2

Hi @kokkuan,

The exercise wants you to add up each month’s rainfall as you go, rather than all at once at the end. Like this:

...
october_rainfall = 2.03
annual_rainfall += october_rainfall

november_rainfall = 2.15
annual_rainfall += november_rainfall
...