You have multiple problems with your code.
- Variable names could be more informative
l
->left_side
. This way you don’t need to have a comment on every line. - You use a variable
n
that is not initialized to anything. - Perhaps split your code into multiple functions. Then you can investigate if each function does what it should.
The first problem at hand is on line 5. You do l[0] = ...
The problem is l
is an empty list, so you can’t access element [0], that is why you get the error.
Instead you could append an element to l:
l.append(a[0])
0
solved struck with raintrap in python