Question: # defaultdict or dict # Take dictionary of classes with students and return the students with their classes and grades for each # Should return
# defaultdict or dict
# Take dictionary of classes with students and return the students with their classes and grades for each
# Should return the following given the info # {'Konny': {('ICS-31', 'B')}, 'Angela': {('Math-3A', 'A')}, 'John': {('Math-3A', 'B'), ('ICS-31', 'A')}, 'Danny': {('ICS-31', 'C')}}

1 from collections import defaultdict 3e def studs_classes (info: (str:f(str,str))-> str:( (str,str): 4. return 6 if name'main' 7 def check_ans (ans, right_ans): if (ans -- right_ans): 8 9 10 print( 'RIGHT Answer!) else: print( 'WRONG Answer!) print(i print('right answer is -', right_ans) input answer wasans) 12 13 14 s 16 17 18 19 info { 'B10-100': {("John', 'A'), ('Danny.', 'C'), (Konny.', 'B')), = PHYS-1": ('John', B'), ('Angela', 'A')>> print(info,info) ans = studs. classes(info) print('answer ans) 20 check (answer,'Konax: ('ICS-31', B'), Angela': ('Math-3A, 'A'), John':'Math-3A, 'B), ('ICS-31, A, Danny:'ICS-31', C')) 21 23 1 from collections import defaultdict 3e def studs_classes (info: (str:f(str,str))-> str:( (str,str): 4. return 6 if name'main' 7 def check_ans (ans, right_ans): if (ans -- right_ans): 8 9 10 print( 'RIGHT Answer!) else: print( 'WRONG Answer!) print(i print('right answer is -', right_ans) input answer wasans) 12 13 14 s 16 17 18 19 info { 'B10-100': {("John', 'A'), ('Danny.', 'C'), (Konny.', 'B')), = PHYS-1": ('John', B'), ('Angela', 'A')>> print(info,info) ans = studs. classes(info) print('answer ans) 20 check (answer,'Konax: ('ICS-31', B'), Angela': ('Math-3A, 'A'), John':'Math-3A, 'B), ('ICS-31, A, Danny:'ICS-31', C')) 21 23
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
