I am writing a code that calculates a curved grade average based off of the score, mean of all scores, and the standard deviation. The code should output "A", "B", "C", "D", or "F" but I am only getting "B" for all scores.
Here is the piece of code that is the problem:
def curveGrades(mean, sd, gradeList):
m = mean
for item in gradeList:
if item >= m + 1.5 * sd:
grade = "A"
elif m + 0.5 * sd <= item < m + 1.5 * sd:
grade = "B"
elif m - 0.5 * sd <= item < m + 0.5 * sd:
grade = "C"
elif m - 1.5 * sd <= item < m - 0.5 * sd:
grade = "D"
elif item < m - 1.5 * sd:
grade = "F"
return grade
It should print all the different letters based of the values in gradeList, but it continues to give me "B" for every score.
Aucun commentaire:
Enregistrer un commentaire