Question: Allowed Things: The + , + = , and all numeric operators in / not in and del operator break and continue str ( )
Allowed Things:
The and all numeric operators
innot in and del operator
break and continue
str int float range len append round and get functions.
List slicing only for recursive functions the last two functions but not for the rest. Disallowed Things:
To import anything.
To use list slicing.
To use any string method.
To use lambda expressions class.
Anything not mentioned in the allowed items above.
Use the global keyword, nor should you have any global variables in other words, do not create any variables outside if a function definition
Hard coding
part :
def finalGradenames PAs, exams:
Description: This function takes a list of students' names, a tuple containing the list of PA grades and the number of grades to drop, and a list of dictionaries with exam scores for each student. It calculates the final grade for each student and stores it in a dictionary where the keys are the students' names and the values are their final grades. This function MUST be implemented by calling the weightedPAs and weightedexams functions. The final grade is the sum of the weighted exam scores in total and the weighted PAs in total
Parameters: names, a list of strings indicating the students' names. PAs, a tuple of lists, where each list contains the list of grades earned for each PA followed by the number of grades that need to be dropped for a student. exams, a list of dictionaries, where each dictionary contains the exam scores each student obtained. The keys of this dictionary are always femt and mt but they may appear in different orders in the dictionary
Return value: A dictionary that shows the names of students as keys and their final scores as values.
Assumptions: All the PAs gardes are between and and all the exam scores are between to inclusively The lengths of names, PAs, and exams are all equal. Examples: finalGradeJohnfe : mt: mt: John:
finalGrade John 'Mason'fe : mt: mt:fe:mt:John: 'Mason':
finalGrade Rose 'Tom', 'Paul'fe : mt: mt:Rose: 'Tom': 'Paul':
Do the part I have already written part and here is the code:
# Part
def weightedPAsgrades drop:
for in rangedrop:
if grades:
lgrades grades
lindex
for i in range lengrades:
if gradesi lgrades:
lgrades gradesi
lindex i
grades.poplindex
if lengrades:
return
total sumgrades
avg total lengrades
weightedavg avg
return roundweightedavg,
# Part
def weightedexamsmtNone, mtNone, fe:
if mt is None:
mt fe
if mt is None:
mt fe
wmtf
wmtf
wfer
for i in rangemt:
wmtf mt
for i in rangemt:
wmtf mt
for i in rangefe :
wfer fe
return wmtf wmtf wfer
# Part
# put your code here make sure the test cases are correct
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
