I want to adjust lists to the same length but the if-elif statement is not working as I thought, its very weird. This might be something so obvious
Code:
l = [1,2,1,4,3,1]
l2 = [1,5,7,3,35,5,66,7]
lenl = len(l)
lenl2 = len(l2)
if l < l2:
l_l2 = lenl - lenl2
list1 = l2
list2 = l
elif l > l2:
l_l2 = lenl2 - lenl
list1 = l
list2 = l2
for i in range(0,l_l2):
list1.append(None)
print(list2)
print(list1)
for i in range(0,l_l2):
list1.remove(None)
print(list1)
I keep getting:
[1, 2, 1, 4, 3, 1]
[1, 5, 7, 3, 35, 5, 66, 7]
[1, 5, 7, 3, 35, 5, 66, 7]
What I want:
[1, 2, 1, 4, 3, 1,None,None]
[1, 5, 7, 3, 35, 5, 66, 7]
[1, 5, 7, 3, 35, 5, 66, 7]