Answered step by step
Verified Expert Solution
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 groupbydata: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 applytogroupsgroups:dict, func:callable:
Apply a function to the list of items for each group.
def mincoursemarksstudentdata, course:
Return the min marks on a given course'
def maxcoursemarksstudentdata, course:
Return the max marks on a given course'
def rollnoofmaxmarksstudentdata, course:
Return the rollno of student with max marks in a course'
def sortrollnobymarksstudentdata, course course course:
Return a sorted list of rollno sorted based on their marks on the three course marks.
course is compared first, then course then course to break ties.
Hint: use tuples comparision
def countstudentsbycitiesstudentdata:
Create a dictionary with city as key and number of students from each city as value.
def citywithmaxnoofstudentsstudentdata:
Find the city with the maximum number of students.
def grouprollnosbycitiesstudentdata:
Create a dictionary with city as key and
a sorted list of rollno of students that belong to
that city as the value.
def citywithmaxavgcoursemarkstudentdata, course:
Find the city with the maximum avg course marks.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started