Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
911 B
29
Indexable
from decimal import Decimal
class SinhVien:
    def __init__(self, s, t, bd):
        self.stt = s
        self.ten = t
        self.diem = 0
        self.diem += Decimal(bd[0]) + Decimal(bd[1])
        for i in bd:
            self.diem += Decimal(i)
        self.diem /= 12
        if self.diem >= 9:
            self.loai = "XUAT SAC"
        elif self.diem >=8:
            self.loai = "GIOI"
        elif self.diem >= 7:
            self.loai = "KHA"
        elif self.diem >= 5:
            self.loai = "TB"
        else:
            self.loai = "YEU"

    def __repr__(self):
        return "HS%02d" % self.stt + " " + self.ten + " " + "%.1f" % self.diem + " " + self.loai
t = int(input())
list = []
for i in range(1, t+1):
    ten = input()
    bd = input().split()
    sv = SinhVien(i, ten, bd)
    list.append(sv)
list.sort(key = lambda x: (x.diem, -x.stt), reverse = True)
for i in list:
    print(i)