Hard
Running Credits per Department
Sort the students by dept and then by name. Add
running, the cumulative sum of credits within each department (groupby('dept')['credits'].cumsum()), and share, each student's credits as a percentage of their department's total (transform('sum')) with 1 decimal. Print dept name running share%.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 110 100.0% CSE Mim 120 31.8% CSE Nadia 245 33.2% CSE Sara 377 35.0% EEE Rafi 98 100.0%
Sample 2
Input
A CSE 3.00 100 END
Output
CSE A 100 100.0%
Output appears here