Calculation of deviation

Hey there,
I Am dealing with Calculation of deviation of 7 groups (each group represent year of study) , each group contain n_i obs of students and i'd like to calculate the
total variance of their grades.
The mean was calculated: sum { w_i * mu_i} / (sum {n_i}) where w_i is the proportion of the group (n_i/N)
Thank you.