arr = [i for i in arr if i>=0] code example Example: if(arr[i]==k) return arr[i]; if(arr[i]==k){ return arr[i]; }