I'm writing some code to create an unsorted list but whenever I try to insert a list using the insert method I get the 'method' object is not subscriptable error. Not sure how to fix it. Thanks.
class UnsortedList:
def __init__(self):
self.theList = list()
def __getitem__(self, i):
print(self.theList[i])
def insert(self, lst):
for x in lst:
try:
self.theList.append(float(x))
except:
print("oops")
myList = UnsortedList()
myList.insert[1, 2, 3]