Spaces:
Running
Running
File size: 585 Bytes
6c961d1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
def evaluate_answers(answers):
"""Calculate final score from all answers"""
if not answers:
return {"score": 0, "band": "N/A"}
total = sum(a["evaluation"]["score"] for a in answers)
avg_score = total / len(answers)
bands = [
(9, "Excellent"),
(7, "Good"),
(5, "Average"),
(3, "Below Average"),
(0, "Poor")
]
band = next((b[1] for b in bands if avg_score >= b[0]), "N/A")
return {
"score": round(avg_score, 1),
"band": band,
"total_questions": len(answers)
} |