student_data is a list of dictionaries, one per student. Every dictionary has a
'rollno' key, a 'city' key, and one key per course holding the marks of that
student in the course, for example:
[{'rollno': 1, 'city': 'Chennai', 'maths': 80, 'physics': 60},
{'rollno': 2, 'city': 'Delhi', 'maths': 55, 'physics': 90}]
Write rollno_of_max_marks(student_data, course) that returns the roll number of
the student with the highest marks in course. student_data is never empty and
every student has the given course. If several students share the highest marks,
return the roll number of the one that comes first in student_data.
Use map with a lambda rather than an explicit loop.
Example
For [{'rollno': 1, 'maths': 80}, {'rollno': 2, 'maths': 95}, {'rollno': 3, 'maths': 60}]
and course = 'maths', the result is 2.
Implement this function:
def rollno_of_max_marks(student_data, course):
Write the function only — the arguments are read for you and the return value is printed automatically.
Arguments arrive as one Python literal per line, in this order: student_data, course.
Input
[{'rollno': 1, 'maths': 80}, {'rollno': 2, 'maths': 95}, {'rollno': 3, 'maths': 60}]
'maths'
Output
2