The syntax for the append method is as follow:
list.append(obj)
So you should replace students.append()
by:
students.append(tmp)
Moreover, your print_info
and input_info
methods are not displaying the properties of a given student, but the properties of the class Student
itself (which are always the same for every instance of the class). You should fix that.
3
solved Create list of object in python [duplicate]