Answers for ".append python ?"

0

what does append mean in python

class Student:
    def __init__(self, name, age, grade):
        self.name = name 
        self.age = age 
        self.grade = grade 

    def get_grade(self):
        return self.grade 

class Course:
    def __init__(self, name, max_student):
        self.name = name 
        self.max = max_student
        self.students = []
        
    def add_student(self, student):
        if len(self.students) < self.max_student: 
            self.students.append(student)
            return True
        return False

    def get_average_grade(self):
        value = 0
        for students in self.students:
            value += Student.get_grade()

        return value / len(self.student)

s1 = Student("Oshadha",20, 100)
s2 = Student("Tom",20, 55)
s3 = Student("Ann",20, 99) 

course = Course("Science", 2)
course.add_student(s1)
course.add_student(s2)
print(Course.get_average_grade())
Posted by: Guest on June-05-2021

Python Answers by Framework

Browse Popular Code Answers by Language