Want to know how python remove() work?

That’s how it does the job:

def remove(arr, n, target):
    for i in range(0, n):
        if arr[i] == target:
            arr[i] = ""
            j = i
            while j < n - 1:
                arr[j] = arr[j+1]
                j = j + 1
    arr = arr[0:n-1]
    print(arr)


remove(["m", "o", "h", "a", "m", "e", "d"], 7, "h")

And, I think the lesson I learned a while ago, is that everything on a computer is an abstraction, No matter how you go deep.

How do you understand it so far? About which parts exactly you aren’t sure?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.