collections.namedtuple, define an Employee type with fields name, department, salary. Implement highest_paid(employee_tuples), which accepts a list of plain (name, department, salary) tuples, converts each into an Employee namedtuple, and returns the Employee with the highest salary — comparing via attribute access (.salary), not index access.highest_paid([('Meera','Analytics',180000), ('Rohit','Analytics',95000)])Employee(name='Meera', department='Analytics', salary=180000)
Meera has the higher salary of the two.
Employee = namedtuple("Employee", ["name", "department", "salary"]).
Employee(*t) unpacks a plain tuple t into a namedtuple instance.