average = grades_average(scores)
variance = 0
for score in scores:
variance += (average - score) ** 2
variance /= float(len(scores))
This code works properly. My question is how come the 2nd variance line (variance /= float(len(scores))) has only one indention while the 1st variance line (variance += (average - score) ** 2) has 2 indention, shouldnt both have the same amount of indention?
Also, why does the answer change even with the amount of indention? one indention only in the 2nd code amounts to 334 which is right while two indention results in 69 whcih is wrong. can someone explain how this works.
thank you very much