Function who delete all None elements


I’d like to write a function that given a position in a list, will transform it in a shorter list without none
example: [1,1,None,1,2,None,1] given the position [4] the resulted list is [1,2], with other words the list stops if it encount a None element.

Thanks in advance



this function call:

sort_list_None([1,1,None,1,2,None,1], 4)

should return [1,2], but why? I don’t see the algorithm you want to implement. What i do see is that you need to take a look at .append() documentation, currently you are trying to attempt to a list named list, that can’t be right.


Thanks, I found a solution for my problem


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