for the last 4 months can’t we just do:
annual_rainfall+= september_rainfall + october_rainfall + november_rainfall + december_rainfall
print annual_rainfall
for the last 4 months can’t we just do:
annual_rainfall+= september_rainfall + october_rainfall + november_rainfall + december_rainfall
print annual_rainfall
I tried the following and did not let me. Is it wrong?
january_to_june_rainfall = 1.93 + 0.71 + 3.53 + 3.41 + 3.69 + 4.50
annual_rainfall = january_to_june_rainfall
july_rainfall = 1.05
annual_rainfall += july_rainfall
august_rainfall = 4.91
annual_rainfall += august_rainfall
september_to_december_rainfall = 5.16 + 7.20 + 5.06 + 4.06
annual_rainfall = january_to_june_rainfall + september_to_december_rainfall
Could you perhaps format your code- How do I format code in my posts? - FAQ / Codecademy FAQ - Codecademy Forums and link the lesson/project this is based on.
The last assignment here seems a little off. January to June and September to December, seems like some months are missing and it also ignores any previous assignments. Check carefully about what items you are assigning (=)
, what items you are adding together (+)
and what items you add to and assign (+=)
.
So I originally tried editing the original line to this "annual_rainfall += august_rainfall + september_rainfall + october_rainfall+november_rainfall+december_rainfall"
I got a Syntax error, so i grabbed the sept, oct, nov and Dec info and moved it above the line and ran it again and it worked out fine. I assume that if the variables are below the line the computer doesnt recognise them as part of the data?