class Student:
def __init__(self,first,last,id):
self._first_name = first
self._last_name = last
self._id_number = id
self._enrolled_in = []
def enroll_in_course(self,course):
self._enrolled_in.append(course)
return self._enrolled_in()
s1 = Student("kathy","lor","323232")
s1.enroll_in_course("hello")
print(s1._enrolled_in)
In the code above, i am getting the error as:
Traceback (most recent call last):
File "main.py", line 14, in s1.enroll_in_course("hello") File "main.py", line 10, in enroll_in_course return self._enrolled_in() TypeError: 'list' object is not callable
I am trying to solve the error, but unable to do so. Can anybody help me here.
_enrolled_inon line 9 - Adithya