I am doing a programming task on Python right now. I have to complete this method:
def add_position(self, n, val):
"""Insert a node with value 'val' as the 'n'th node."""
if n < 0 or n > self.get_size():
raise IndexError("List index {} out of range".format(n))
I have worked on this method many hours but I really can't get what to do here. Can someone help me?