I have to create a code(function) that moves elements in a list without using temporary list and the function has to return nothing, I've tried the following but It won't work please help
def move_zeros_v2(lst):
left = []
right = []
left_a = left.append
right_a = right.append
for x in lst:
if x:
left_a(x)
else:
right_a(x)
left.extend(right)
i = 0
while i < len(left):
lst[i] = left[i]
i = i + 1
x = [1, 0, 3, 0, 0, 5, 7]
z=move_zeros_v2(x)
print(x, z)