I'd like to find the average of the student's test grades and hw, then run a function that gives them a final score assuming HW is 20% and Test is 80%
student_tests = {
'Stan_test': [64, 90, 78, 80],
'Richard_tests': [99, 87, 92, 90],
'Nicole_tests': [6, 66, 6, 66],
'David_tests': [78, 91, 92, 96], }
student_hw = {
'Sten_hw': [100, 90, 85, 99, 46],
'Richard_hw': [96, 66, 94, 77, 88],
'Nicole_hw': [100, 100, 100, 100, 100],
'David_hw': [68, 71, 74, 77, 80] }
results_tests = {}
for k, v in student_tests.items():
if type(v) in [float, int]:
results_tests[k] = v
else:
results_tests[k] = sum(v) / len(v)
print(results_tests)
results_hw = {}
for k, v in student_hw.items():
if type(v) in [float, int]:
results_hw[k] = v
else:
results_hw[k] = sum(v) / len(v)
print(results_hw)
def calculate_average():
for i in results_tests.values():
i = i * 80 / 100
for a in results_hw.values():
a = a * 20 / 100
b = i + a
print(b)
calculate_average()