Question: PYTHON PROBLEM Need to write top_students function Not sure if need to use defaultdict or just dict The function takes studs as an argument then

PYTHON PROBLEM

Need to write top_students function

Not sure if need to use defaultdict or just dict

The function takes studs as an argument then checks who has the top grade and returns the student(s) who have the top grade as a {str} as shown in the last line of each check

PYTHON PROBLEM Need to write top_students function Not sure if need to

1 from collections import defaultdict 2 3e def top_students (stu_grades (str,str) 4 str: pass 6 if name'main' 7 def check_ans (ans, right_ans): (ans print('RIGHT Answer!') 8 if right-ans): 9 10 else: print( 'hRONG Answer! ') print(' print(' right answer is-, right_ans) input answer wasans) 12 13 14 15 16 #Check 1 studs print('argumentstuds) ans = top-students(studs) print(answerans) {('Angel. ' , 'C'),("John', 'B-'),("Kono. ' , 'B-'),('Leon . , 'D'),('Porsche', 'C+')} 18 19 20 check_ans (ans, 'John', 'Konn) 21 # Check 2 studs print('argumentstuds) ans top-students(studs) print answer, ans) {("Angel. ' , 'C),("John","D'),(Konny', 'C'),('Leon', 'F'),('Porsche', 'C')} 23 24 25 26 27 check_ans(ans, 'Angela', 'Konny', Porsche')

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!