May-11-2021, 11:25 AM
(May-11-2021, 10:51 AM)perfringo Wrote: Python documentation, The return statement:
Quote:return may only occur syntactically nested in a function definition, not within a nested class definition.
Function is nowhere to be seen.
I just did not paste the beginning of the function but it is not a problem. THe problem is that I cannot delete my elements from the list. I tried a small program for seeing what is going on here and the result is same:
l2=[0,1,2,3,4,5,6,7,8,9] a=1 l2.copy() for ind,el in enumerate(l2): if a==el: l2.remove(ind) else: #l2.pop(ind) l2.remove(ind) print(l2)it should return an empty list but no !