Nested For Loops Python (Beginner Question)
I have an idea of what I need to do for data extraction from the question, but I am unable to actually write the code from scratch: Daily rainfall (measured in mm) in Brighton for first quarter of the year are stored in the following lists: jan = [1, 3, 0, 4, 6, ...] feb = [5, 0, 0, 2, 3, ...] mar = [10, 31, 21, 53, 9, ...] ... represents more values not shown The following list contains the daily rainfall for the first quarter of the year rainfall = [jan, feb, mar] Write a program to find (a) for each month, the number of days where there is no rain (b) the average rainfall for the first quarter I barely managed (a): for day in jan: if day == 0: print("Zero rainfall days in jan: ") print(day) for day in feb: if day == 0: print("Zero rainfall days in feb: ") print(day) for day in mar: if day ==0: print("Zero rainfall days in mar: ") print(day) How can I 'count' the number of 0's? How can I add all index values and divide by index count for (b)? Thank you in advance!