LearnPy Hub
← Pandas: DataFrames problems
Medium

Sort by Department, Then CGPA

Sort the students by dept (A to Z) and, within a department, by cgpa from highest to lowest. Print each as dept name cgpa.

Input

Lines 'name dept cgpa credits', then END.

Output

Lines.

Sample 1

Input
Mim CSE 3.82 120
Rafi EEE 3.41 98
Sara CSE 3.95 132
Tuhin BBA 3.60 110
Nadia CSE 3.71 125
END
Output
BBA Tuhin 3.60
CSE Sara 3.95
CSE Mim 3.82
CSE Nadia 3.71
EEE Rafi 3.41

Sample 2

Input
A CSE 3.00 100
END
Output
CSE A 3.00
solution.py
Output appears here
Sort by Department, Then CGPA · Python practice problem · LearnPy Hub