Most constellations can only be seen in the sky at certain times of the year.
So if you choose to analyse the observations of a specific constellation, such as Orion, there won't be any data available for some of the months.
To work out our average, we divided by the number of numbers. Dividing by zero doesn't work, so Python will get confused and give you an error message!
We can fix the error by getting the program to check whether there are any data for a month before trying to work out the average of it.
To do this, start an if statement, telling it to check if the length of the month is larger than zero.
if month in data.list > 0:
Inside this if statement, you can put your original code to find the average.
Add an else underneath, to tell it not to do the calculation if it can't do it - we can ask it to put a 0 in the list instead.
else: averages.append(0)
Test this code and check for errors - remember that this should replace your current code to get the average, as we giving the program some extra instructions to do before it works out the average.
Try it out by changing the stars variable to a single constellation - does it work out the averages without giving you an error message?
If your code isn't working the way you expect, compare it to the example below.
Check your indentation and look for spelling mistakes as well!
for month in data.list:
if len(month) > 0:
averages.append(sum(month)/len(month))
else:
averages.append(0)
print(averages)