Why Do I Have to Use `float()`?


#1

Why did I have to divide it by float(len(grades_input)) and not only len(grade_input)?


FAQ: Learn Python - Exam Statistics - Computing the Average
#2

len() gives an integer, and if then the division involves two integers, python2 will return an integer (round down if needed), which is not desired