Distinct departments
Your task
To populate a dropdown filter, extract the department list from a raw HR export. Each row is "name,dept". Return the distinct department names, sorted alphabetically. Example: ["ava,eng", "raj,sales", "mia,eng"] gives ["eng", "sales"].
Examples
list_departments(rows: list[str]) -> list[str]Example 1
Input
list_departments(["ava,eng", "raj,sales", "mia,eng"])Output
["eng", "sales"]