Need to setup four different algorithms and flowcharts for calculating a student
ID: 3885657 • Letter: N
Question
Need to setup four different algorithms and flowcharts for calculating a student’s letter grade given the following (do not use straight-through logic);
90-100 = A
80-89 = B
70-79 = C
60-69 = D
below 60 = F
The solutions in the text study book are incorrect. I'm not looking for answers, just an understanding. Once the algorithims are developed, I can easily create the flowcharts.
Explanation / Answer
Algo: def getLetterGrade(score): score = round(score) grades = [(90, 'A'), (80, 'B'), (70, 'C'), (60, 'D'), (0, 'F')] for i in range(len(grades)): if score >= grades[i][0]: return grades[i][1] =================== 2nd Algo def getLetterGrade(score): score = round(score) if score >= 90: return "A" if 90 > score >= 80: return "B" if 80 > score >= 70: return "C" if 70 > score >= 60: return "D" if 60 > score: return "F"
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.