# Split a list into two smaller lists

**URL:** <https://cl.desmos.com/t/split-a-list-into-two-smaller-lists/2307>\
**Category:** Questions\
**Created:** [January 4, 2021, 10:10pm UTC](https://cl.desmos.com/t/split-a-list-into-two-smaller-lists/2307 "2021-01-04T22:10:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dongaa](https://avatars.discourse-cdn.com/v4/letter/d/848f3c/32.png) [@dongaa](https://cl.desmos.com/u/dongaa)\
**Post date:** [January 4, 2021, 10:10pm UTC](https://cl.desmos.com/t/split-a-list-into-two-smaller-lists/2307/1 "2021-01-04T22:10:17Z")

</div>

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.

> **[Split List](https://www.desmos.com/calculator/yx3zphqyre)**

Is there a better way to do this?

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [January 4, 2021, 10:28pm UTC](https://cl.desmos.com/t/split-a-list-into-two-smaller-lists/2307/2 "2021-01-04T22:28:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dongaa](https://avatars.discourse-cdn.com/v4/letter/d/848f3c/32.png) [@dongaa](https://cl.desmos.com/u/dongaa)\
**Post date:** [January 4, 2021, 11:32pm UTC](https://cl.desmos.com/t/split-a-list-into-two-smaller-lists/2307/3 "2021-01-04T23:32:59Z")

</div>

Oh this is very nice and not complicated. Thanks!
