Split a list into two smaller lists

This is what I currently have for splitting a list into two parts, a list containing the negative values and a list containing the non-negative values.

Is there a better way to do this?

You can set conditions to create new lists:

L=p[p<0] for example would create a new list with only the elements in list p that are less than 0. There’s a lot you can do with this.

L=p[2...5] would create a new list using elements 2-5 from list p.

1 Like

Oh this is very nice and not complicated. Thanks!