Need Help ?
Have a Question ?

(Solved): Below, You MUST Complete Both Functions As Described In The "doc Comment" Below Each Function Declar ...

Below, you MUST complete both functions as described in the "doc comment" below
each function declaration in python3

You also MUST add yourself as a student to the gradebook dictionary.

# Here is the data structure you will be working with.
# It is a dictionary of students.
# Each student contains a dictionary of grades.
gradebook = {
"Alberta" : {
"Exam 1": 77, "Exam 2": 83, "Exam 3": 73, "Final": 85
},
"Bernard" : {
"Exam 1": 84, "Exam 2": 91, "Exam 3": 98, "Final": 95
},
"Cindi" : {
"Exam 1": 100, "Exam 2": 95, "Exam 3": 98, "Final": 95
},
"Doak" : {
"Exam 1": 68, "Exam 2": 65, "Exam 3": 77, "Final": 75
},
"Eunice" : {
"Exam 1": 82, "Exam 2": 85, "Exam 3": 81, "Final": 80
},
"Frank" : {
"Exam 1": 93, "Exam 2": 95, "Exam 3": 91, "Final": 95
},
"Harriet" : {
"Exam 1": 100, "Exam 2": 99, "Exam 3": 100, "Final": 100
},
}

def grades_for_student(name):
'''
Print out a report of grades for a specified student. Assume that you should
use the "gradebook" dictionary defined above as a "global" variable. Not
generally a good idea, but we'll run with it.

Your function should:

1) Print out a header row using print_header().
2) Retrieve the dictionary of grades for the specified student. Since this
is the value in the gradebook dictionary for a given student, you can
get this dictionary simply by asking for gradebook[name] (here using
the "name" parameter passed in to this function).
3) Iterate through the dictionary of grades. Print each "key" (exam name)
and value (exam grade) using your print_integer_line() function.
4) Print a footer row using print_footer()

CHALLENGE 1: Calculate and print a grade average for the student (as shown
in the example). Use print_float_line() for this.
  
CHALLENGE 2: Print out the ACTUAL current date in the footer. (Bing your
way to an answer)

So for example, calling grades_for_student("Frank") should output as
follows (the average line would be missing if you don't take the challenge):

GRADES FOR FRANK
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Exam 1 93
Exam 2 95
Exam 3 91
Final 95
------------------------------------------------------------
AVERAGE: 93.50
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
02/19/20 Student Grade Report Page 1 of 1

'''
global gradebook
##### Your code goes below here #####


def grades_for_exam(exam):
'''
Print out a report of grades for a specified exam. Again, use the gradebook
dictionary defined above as a "global" variable.

Your function should:

1) Print out a header row using print_header().
2) Iterate over each of the students in the gradebook.
3) For each student, print the grade for the exam specified in the exam
parameter passed in to the function. This is a little trickier than the
other one. In essence, though, you can do something akin to:

for name in gradebook:
grades = gradebook[name] # grades for this student
exam_grade = grades[exam] # grade for the specified exam

Use your print_integer_line() to print the name and grade for each student.
4) Print a footer row using print_footer()

CHALLENGE 1: Calculate and print a grade average for the exam (as shown
in the example). Use print_float_line() for this.
  
CHALLENGE 2: Print out the ACTUAL current date in the footer. (Bing your
way to an answer)

So for example, calling grades_for_exam("Exam 2") should output as
follows (the average line would be missing if you don't take the challenge):

GRADES FOR EXAM 2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Alberta 83
Bernard 91
Cindi 95
Doak 65
Eunice 85
Frank 95
Harriet 99
------------------------------------------------------------
AVERAGE: 87.57
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
02/19/20 Exam Grade Report Page 1 of 1

'''
global gradebook
##### Your code goes below here #####


### HERE IS THE "MAIN" PART OF THE SCRIPT...
### IT SIMPLY CALLS THE FUNCTIONS YOU COMPLETED ABOVE.

grades_for_student("Frank")
print()
grades_for_exam("Exam 2")
print()
grades_for_student("Cindi")
print()
grades_for_exam("Final")
print()

'''
MY OUTPUT FOR THE ABOVE FOUR FUNCTION CALLS LOOKS AS FOLLOWS...YOURS SHOULD
BE VERY SIMILAR (THOUGH YOUR NAME SHOULD ALSO BE IN THE LIST OF GRADES FOR
EACH EXAM):

GRADES FOR FRANK
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Exam 1 93
Exam 2 95
Exam 3 91
Final 95
------------------------------------------------------------
AVERAGE: 93.50
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
02/19/20 Student Grade Report Page 1 of 1

GRADES FOR EXAM 2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Alberta 83
Bernard 91
Cindi 95
Doak 65
Eunice 85
Frank 95
Harriet 99
------------------------------------------------------------
AVERAGE: 87.57
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
02/19/20 Exam Grade Report Page 1 of 1

GRADES FOR CINDI
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Exam 1 100
Exam 2 95
Exam 3 98
Final 95
------------------------------------------------------------
AVERAGE: 97.00
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
02/19/20 Student Grade Report Page 1 of 1

GRADES FOR FINAL
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Alberta 85
Bernard 95
Cindi 95
Doak 75
Eunice 80
Frank 95
Harriet 100
------------------------------------------------------------
AVERAGE: 89.29
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
02/19/20 Exam Grade Report Page 1 of 1

'''

Expert Answer


As per your problem requirement i have implemented both the functions , i.e. grades_for_exam ,andgrades_for_student I have pasted raw code for your reference with line by line documentation kindly g
We have an Answer from Expert Buy This Answer $6