# Lists / Sorting a List

**URL:** <https://discuss.python.org/t/lists-sorting-a-list/16144>\
**Category:** Python Help\
**Tags:** help\
**Created:** [June 1, 2022, 12:35am UTC](https://discuss.python.org/t/lists-sorting-a-list/16144 "2022-06-01T00:35:13Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![malik](https://avatars.discourse-cdn.com/v4/letter/m/e36b37/32.png) [@malik](https://discuss.python.org/u/malik)\
**Post date:** [June 2, 2022, 12:54am UTC](https://discuss.python.org/t/lists-sorting-a-list/16144/4 "2022-06-02T00:54:34Z")

</div>

Hello! Thank you for your response!  
I will just give you what I want as a response.

1. Imagine we have thousands of rows. and I want the `logs` variable to start with `LIKE` actions first. Like i showed in the example.

```auto
logs: List = [
    ['30-MAY', 'user1', 'LIKE'],
    ['25-MAY', 'user145', 'LIKE'],
    ['31-MAY', 'user3', 'LIKE'],
    ['23-MAY', 'user90', 'LIKE'],
    ['1-JUNE', 'user12', 'LIKE'],
    ['29-MAY', 'user20', 'COMMENT'],
    ['31-MAY', 'user11', 'COMMENT'],
    ['27-MAY', 'user16', 'COMMENT'],
    ['28-MAY', 'user5', 'COMMENT'],
    ['1-JUNE', 'user8', 'SAVE'],
    ['1-JUNE', 'user89', 'SAVE'],
]

```

1. Again, imagine we have a lot of data here, and I want to see the most popular action. Please have a look at the example below. So we have 5 `LIKE` actions, then 4 `COMMENT` and 2 `SAVE`.

```auto
logs: List = [
    ['30-MAY', 'user1', 'LIKE'],
    ['25-MAY', 'user145', 'LIKE'],
    ['31-MAY', 'user3', 'LIKE'],
    ['23-MAY', 'user90', 'LIKE'],
    ['1-JUNE', 'user12', 'LIKE'],
    ['29-MAY', 'user20', 'COMMENT'],
    ['31-MAY', 'user11', 'COMMENT'],
    ['27-MAY', 'user16', 'COMMENT'],
    ['28-MAY', 'user5', 'COMMENT'],
    ['1-JUNE', 'user8', 'SAVE'],
    ['1-JUNE', 'user89', 'SAVE'],
]

```

Hope it makes more sense now, if not, please leave a comment and I will reply.

---

_[View the full topic](https://discuss.python.org/t/lists-sorting-a-list/16144)._
