Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

def groupby ( data:list, key:callable ) : ' ' ' Given a list of items, and a key, create a dictionary with the key as

def groupby(data:list, key:callable):
'''
Given a list of items, and a key, create a dictionary with the key as key function called
on item and the list of items with the same key as the corresponding value.
The order of items in the group should be the same order in the original list
'''
...
def apply_to_groups(groups:dict, func:callable):
'''
Apply a function to the list of items for each group.
'''
...
def min_course_marks(student_data, course):
'''Return the min marks on a given course'''
...
def max_course_marks(student_data, course):
'''Return the max marks on a given course'''
...
def rollno_of_max_marks(student_data, course):
'''Return the rollno of student with max marks in a course'''
...
def sort_rollno_by_marks(student_data, course1, course2, course3):
'''
Return a sorted list of rollno sorted based on their marks on the three course marks.
course1 is compared first, then course2, then course3 to break ties.
Hint: use tuples comparision
'''
...
def count_students_by_cities(student_data):
'''
Create a dictionary with city as key and number of students from each city as value.
'''
...
def city_with_max_no_of_students(student_data):
'''
Find the city with the maximum number of students.
'''
...
def group_rollnos_by_cities(student_data):
'''
Create a dictionary with city as key and
a sorted list of rollno of students that belong to
that city as the value.
'''
...
def city_with_max_avg_course_mark(student_data, course):
'''
Find the city with the maximum avg course marks.
'''
...

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Creating A Database In Filemaker Pro Visual QuickProject Guide

Authors: Steven A. Schwartz

1st Edition

0321321219, 978-0321321213

More Books

Students also viewed these Databases questions