-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDay-12.py
40 lines (37 loc) · 1.04 KB
/
Day-12.py
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
class Person:
def __init__(self, firstName, lastName, idNumber):
self.firstName = firstName
self.lastName = lastName
self.idNumber = idNumber
def printPerson(self):
print("Name:", self.lastName + ",", self.firstName)
print("ID:", self.idNumber)
class Student(Person):
def __init__(self,firstName,lastName,idNum,scores):
self.firstName=firstName
self.lastName=lastName
self.idNumber=idNum
self.scores=scores
def calculate(self):
a=round(sum(self.scores)/len(self.scores))
if a >= 90:
return 'O'
elif 90>a>=80:
return 'E'
elif 80>a>=70:
return 'A'
elif 70>a>=55:
return 'P'
elif 55>a>=40:
return 'D'
else:
return 'T'
line = input().split()
firstName = line[0]
lastName = line[1]
idNum = line[2]
numScores = int(input()) # not needed for Python
scores = list( map(int, input().split()) )
s = Student(firstName, lastName, idNum, scores)
s.printPerson()
print("Grade:", s.calculate())