-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathday12.py
48 lines (39 loc) · 1.39 KB
/
day12.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
41
42
43
44
45
46
47
48
print_object = print
def print(*items_to_print):
if 'Grade: ' in items_to_print:
items_to_print = map(str, items_to_print)
print_object(''.join(items_to_print))
else:
print_object(*items_to_print)
class Student(Person):
# Class Constructor
def __init__(self, firstName, lastName, idNumber, scores):
super().__init__(firstName, lastName, idNumber)
self.scores = scores
# Parameters:
# firstName - A string denoting the Person's first name.
# lastName - A string denoting the Person's last name.
# id - An integer denoting the Person's ID number.
# scores - An array of integers denoting the Person's test scores.
#
# Write your constructor here
# Function Name: calculate
# Return: A character denoting the grade.
#
# Write your function here
def calculate(self):
a = sum(self.scores) / len(self.scores)
if a < 40:
return "T"
elif (40 <= a) and (a < 55):
return "D"
elif (55 <= a) and (a < 70):
return "P"
elif (70 <= a) and (a < 80):
return "A"
elif (80 <= a) and (a < 90):
return "E"
elif (90 <= a) and (a <= 100):
return "O"
else:
return ""