-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path0nhap.py
More file actions
58 lines (50 loc) · 1.29 KB
/
0nhap.py
File metadata and controls
58 lines (50 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import math
class Student(object):
def __init__(self, id, name, diem):
self.name = name
self.diem = diem
self.id = id
sum = 0.0
for i in range(10):
if i == 0 or i == 1:
sum = float(sum)+diem[i]*2
else:
sum = float(sum)+diem[i]
sum /= 12
sum *= 100
sum = math.floor(sum)
f = int(sum % 10)
if f >= 5:
sum = (sum+10-f)/100
else:
sum = (sum-f)/100
self.tb = sum
def xeploai(self):
if self.tb >= 9:
return "XUAT SAC"
if self.tb >= 8.0:
return "GIOI"
if self.tb >= 7.0:
return "KHA"
if self.tb >= 5.0:
return "TB"
return "YEU"
def ma(self):
id = "HS"
if self.id < 10:
id += "0" + str(self.id)
else:
id += str(self.id)
return id
def __str__(self):
return self.ma() + " " + self.name + " " + str(self.tb) + " " + self.xeploai()
n = int(input())
a = []
for i in range(n):
ten = input()
diem = [float(i) for i in input().split()]
temp = Student(i+1, ten, diem)
a.append(temp)
a.sort(key=lambda x: (-x.tb))
for i in a:
print(i)