Python's Built-in Operations: A Big-O Cheat Sheet
Time complexity of operations on Python's built-in types

The official Python documentation details the time complexity of operations on built-in types, from lists and dicts to memoryviews and ranges. It covers average-case costs, worst-case scenarios for hash collisions, and notes on implementation specifics like CPython's list resizing and frozendict's immutability.
If you need to add or remove at both ends, consider using a collections.deque instead.