What is the difference between list.sort() and sorted() in Python?
Learn the difference between Python's built-in list sorting methods and when one is preferred over the other.
The Python snippet collection contains helper functions for Python 3.6. It includes utilities for most common data types, such as primitivies, lists, dictionaries and date objects.
Learn the difference between Python's built-in list sorting methods and when one is preferred over the other.
There's a good way to test the emptiness of a Python list and a better one. Which one are you using?
Writing efficient Python code can be tricky. Read how we optimize our list snippets to increase performance using a couple of simple tricks.
Sort a Python list based on another list containing the desired indexes.
Learn how to find the matching values, indexes or keys in a list or dictionary.
Convert a dictionary to a list of tuples and vice versa.
Understand Python's named tuples and start using them in your projects today.
Learn how Python's lists and tuples are different and level up your code today.
Master list initialization, using simple techniques and level up your Python skills.
Filter unique or non-unique values from a list using collections.Counter
.
Learn how to sort a Python dictionary list using a tuple key.
Chunks a list into a set amount of smaller lists or into lists of a specified size.
Learn everything you need to know about Python's slice notation with this handy guide.
Find the index of the element with the minimum or maximum value in a list.
Learn everything you need to know about Python's slice assignment with this handy guide.
Move a specified amount of elements to the end of a list.
Learn how to perform some very common operations on Python lists, such as getting the first, last, initial, head, and tail elements.