Python List Snippets

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.

  • Count occurrences

    Counts the occurrences of a value in a list.

    Python, List · Jan 9, 2021

  • Partial sum list

    Creates a list of partial sums.

    Python, List · Jan 13, 2021

  • Check for duplicates in list

    Checks if there are duplicate values in a flat list.

    Python, List · Nov 2, 2020

  • List head

    Returns the head of a list.

    Python, List · Sep 15, 2020

  • List without last element

    Returns all the elements of a list except the last one.

    Python, List · Nov 2, 2020

  • List intersection

    Returns a list of elements that exist in both lists.

    Python, List · Nov 2, 2020

  • List is contained in other list

    Checks if the elements of the first list are contained in the second one regardless of order.

    Python, List · Jan 7, 2021

  • Last list element

    Returns the last element in a list.

    Python, List · Nov 2, 2020

  • List union

    Returns every element that exists in any of the two lists once.

    Python, List · Nov 2, 2020