Hard
Compare Each Student With Their Department
For each student compute how far their cgpa is from their department's average, in units of the department's standard deviation: (cgpa − dept mean) / dept std, using
groupby(...).transform with std(ddof=0). When a department's std is 0, use 0. Print each name z with z to 2 decimals in the original order, then the name of the student with the largest z (first if tied).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
Mim -0.07 Rafi 0.00 Sara 1.26 Tuhin 0.00 Nadia -1.19 Sara
Sample 2
Input
A CSE 3.00 100 END
Output
A 0.00 A
Output appears here