Write in Python 3.) Write the pseudo-code of an algorithm that reads a list of n
ID: 3743768 • Letter: W
Question
Write in Python
3.) Write the pseudo-code of an algorithm that reads a list of numbers containing the final grades of a given group of students in some course (on a 100-point scale). The algorithm should print a list with the corresponding letter grade for each student. As an example if the algorithm reads [93.2, 69.8, 78.3, 82.6, 95.1, 59.4], the output should be [A C, C, B, A, F].
Explanation / Answer
def get_grades(scores): grades = [] for score in scores: if score >= 90: grades.append('A') elif score >= 80: grades.append('B') elif score >= 70: grades.append('C') elif score >= 60: grades.append('D') else: grades.append('F') return grades print(get_grades([93.2, 69.8, 78.3, 82.6, 95.1, 59.4]))
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.