# Putting or sorting a list in order

**URL:** <https://forum.code.org/t/putting-or-sorting-a-list-in-order/34119>\
**Category:** Coding and Debugging Help\
**Created:** [January 24, 2021, 2:59am UTC](https://forum.code.org/t/putting-or-sorting-a-list-in-order/34119 "2021-01-24T02:59:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mreckling](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/mreckling/32/4946_2.png) [@mreckling](https://forum.code.org/u/mreckling)\
**Post date:** [January 24, 2021, 2:59am UTC](https://forum.code.org/t/putting-or-sorting-a-list-in-order/34119/1 "2021-01-24T02:59:44Z")

</div>

I am stuck! I want to have my students take input (numbers) from a user and then store them in a list (easy), but display the list in order from smallest to greatest.  
Any help or tips would be appreciated!  
Thanks!

---

<div class="post-metadata">

**Author:** ![jdonwells](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/jdonwells/32/7900_2.png) [@jdonwells](https://forum.code.org/u/jdonwells)\
**Post date:** [January 24, 2021, 1:52pm UTC](https://forum.code.org/t/putting-or-sorting-a-list-in-order/34119/2 "2021-01-24T13:52:13Z")

</div>

You could show them a simple sort algorithm like bubble sort or you can tell them about the sort method on Arrays. Which ever fits your curriculum.

---

<div class="post-metadata">

**Author:** ![frank\_w\_lee](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/frank_w_lee/32/4895_2.png) [@frank\_w\_lee](https://forum.code.org/u/frank_w_lee)\
**Post date:** [January 24, 2021, 10:59pm UTC](https://forum.code.org/t/putting-or-sorting-a-list-in-order/34119/3 "2021-01-24T22:59:30Z")

</div>

Yep, what Don said.

In other words, if you’re wondering if there’s a built-in function to sort an array, there is not. But it’s a great opportunity to learn sorting algorithms (and as Don suggested, bubble sort is a good place to start).

---

<div class="post-metadata">

**Author:** ![jdonwells](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/jdonwells/32/7900_2.png) [@jdonwells](https://forum.code.org/u/jdonwells)\
**Post date:** [January 25, 2021, 3:02am UTC](https://forum.code.org/t/putting-or-sorting-a-list-in-order/34119/4 "2021-01-25T03:02:12Z")

</div>

App Lab does have a sort method on Arrays. `[3,2,1].sort();` returns `[1,2,3]`.

---

<div class="post-metadata">

**Author:** ![frank\_w\_lee](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/frank_w_lee/32/4895_2.png) [@frank\_w\_lee](https://forum.code.org/u/frank_w_lee)\
**Post date:** [January 25, 2021, 4:45am UTC](https://forum.code.org/t/putting-or-sorting-a-list-in-order/34119/5 "2021-01-25T04:45:36Z")

</div>

Oh whaaaaaat. Thank you for pointing that out. I stand corrected.

---

<div class="post-metadata">

**Author:** ![lopezk](https://avatars.discourse-cdn.com/v4/letter/l/a9adbd/32.png) [@lopezk](https://forum.code.org/u/lopezk)\
**Post date:** [April 2, 2024, 6:43pm UTC](https://forum.code.org/t/putting-or-sorting-a-list-in-order/34119/6 "2024-04-02T18:43:39Z")

</div>

If student use the Arrays[3,2,1] to be sorted in order, that needs to be cited? or can student use arrays in their code?
