def __init__(self,name,ID,score):
self.name = name
self.ID = ID
self.score = score
def get_score(self):
return self.score
def display(self):
print('Name : ',self.name)
print('ID : ',self.ID)
print('Score : ',self.score)
def set_score(self):
return self.score
def setup():
stu = [Student('A',123,69),
Student('B',456,80),
Student('C',789,18),
Student('D',753,59),
Student('E',951,27)]
show_all_grade(stu)
def find_grade(stu):
if(stu.get_score()>=80):
return 'A'
elif(stu.get_score()>=70 and stu.get_score()<80):
return 'B'
elif(stu.get_score()>=60 and stu.get_score()<70):
return 'C'
elif(stu.get_score()>=50 and stu.get_score()<60):
return 'D'
else:
return 'F'
def count_grade(stu):
n = 0
i = 0
s = stu[i].get_score()
while(i<len(stu)):
if(s>=80):
n =n+1
elif(s>=70 and s<80):
n=n+1
elif(s>=60 and s<70):
n=n+1
elif(s>=50 and s<60):
n=n+1
else:
n=n+1
i=i+1
return n
def show_all_grade(stu):
i = 0
while(i<len(stu)):
stu[i].display()
print("Grade :",find_grade(stu[i]))
print()
i=i+1
setup()