Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In Python: Write a function called finalExamGrade that will find what a student

ID: 3776884 • Letter: I

Question

In Python:

Write a function called finalExamGrade that will find what a student needs to get in order to get each letter grade. This function will
take as input a dictionary called student. It will contain all the grades of a single student. The function should find out exactly what
grade the student needs to get an A, B+, B, C+, C, and D. It should return a dictionary that will map each letter to the needed grade.
You will need following information to calculate the grade:

letterGradeScale: {'A': 90, 'B+': 85, 'B':80, 'C+': 75, 'C': 70, 'D': 65}

Grading Formula:
Homework - 10%
Attendance - 4%
Exam1, Exam2 - 20% each
Final Exam - 30%
Roadmap project - Project 1 & project 2 - 5% each
Class Recap - 6%


output:
{'A': 98, 'B+': 92, 'B': 85, 'C+': 80, 'C': 74, 'D': 68}

Explanation / Answer

main.py

def finalExamGrade(student, letterGradeScale):
  
"""
Grading Formula:
Homework - 10%
Attendance - 4%
Exam1, Exam2 - 20% each
Final Exam - 30%
Roadmap project - Project 1 & project 2 - 5% each
Class Recap - 6%
"""
totalGrade = 0
totalGrade += student['homework'] * 0.10
totalGrade += student['attendance'] * 0.04
totalGrade += student['exam1'] * 0.20
totalGrade += student['exam2'] * 0.20
totalGrade += student['project1'] * 0.05
totalGrade += student['project2'] * 0.05
totalGrade += student['classrecap'] * 0.06
print(totalGrade)
A = (letterGradeScale['A'] - totalGrade) / 0.30
Bp = (letterGradeScale['B+'] - totalGrade) / 0.30
B = (letterGradeScale['B'] - totalGrade) / 0.30
Cp = (letterGradeScale['C+'] - totalGrade) / 0.30
C = (letterGradeScale['C'] - totalGrade) / 0.30
D = (letterGradeScale['D'] - totalGrade) / 0.30
aKey = {A:'A',
Bp:'B+',
B:'B',
Cp: 'C+',
C:'C',
D: 'D',}
rtnDict = {}
rnLst = [A, Bp, B, Cp, C, D]
for grade in rnLst:
if grade > 100:
rtnDict[aKey[grade]] = 'N/A'
else:
rtnDict[aKey[grade]] = grade
return rtnDict

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote