I am new to Python and i have been scribbling with lists. i want to only print out the positive numbers in my list,However only the first negative element gets removed, the second negative element remains as it is.
Here's my code:
def myfunc(mylist1) :
    print("List before sorting the elements : ", mylist1)
    mylist1.sort()
    print("List after sorting the elements : ", mylist1)
    for i in range(0,len(mylist1)) :
        if mylist1[i] <= 0  :
            del mylist1[i]
        else:
            break
    print("After Operations,Final list : ", mylist1)
    return
mylist = [67,78,54,-20,-23,44]
myfunc(mylist)
Output:
List before sorting the elements :  [67, 78, 54, -20, -23, 44]
List after sorting the elements :  [-23, -20, 44, 54, 67, 78]
After Operations,Final list :  [-20, 44, 54, 67, 78]
 
    