It's O(n), also check out: http://wiki.python.org/moin/TimeComplexity

This page documents the time-complexity (aka "Big O" or "Big Oh") of various operations in current CPython. Other Python implementations (or older or still-under development versions of CPython) may have slightly different performance characteristics. However, it is generally safe to assume that they are not slower by more than a factor of O(log n)...

Answer from Zach Kelling on Stack Overflow
🌐
DEV Community
dev.to › williams-37 › understanding-time-complexity-in-python-functions-5ehi
Understanding Time Complexity in Python Functions - DEV Community
October 25, 2024 - ... Removing an element (by value) requires searching for the element first, which takes linear time. ... Python’s built-in sorting algorithm (Timsort) has a time complexity of O(n log n) in the average and worst cases.
Discussions

algorithm - python str.index time complexity - Stack Overflow
For finding the position of a substring, inside a string, a naive algorithm will take O(n^2) time. However, using some efficient algorithms (eg KMP algorithm), this can be achieved in O(n) time: s... More on stackoverflow.com
🌐 stackoverflow.com
Does pop(i) have a Time Complexity of O(n) or O(k)?
How are infinitely large numbers represented and used like Python’s int class and Haskell’s Integer type? ... Clarification on Time Complexity for Python Sets vs. More on reddit.com
🌐 r/learnpython
3
3
July 1, 2020
python - what is the time complexity of list.index(obj) method? - Stack Overflow
This page documents the time-complexity (aka "Big O" or "Big Oh") of various operations in current CPython. Other Python implementations (or older or still-under development versions of CPython) may have slightly different performance characteristics. More on stackoverflow.com
🌐 stackoverflow.com
python - What is the time complexity to get the last index for an array? - Stack Overflow
for the given array it takes O(1) ... ends at index 3 by default ? In other words how is array[-1] is implemented in python? ... That's not an array, it's a list. ... Save this answer. Show activity on this post. Accessing any array element is in constant time, since it is ... More on stackoverflow.com
🌐 stackoverflow.com
🌐
Medium
medium.com › @ivanmarkeyev › understanding-python-list-operations-a-big-o-complexity-guide-49be9c00afb4
Understanding Python List Operations: A Big O Complexity Guide | by Ivan Markeev | Medium
June 4, 2023 - Under the hood, lists use an underlying array structure to store their elements. This enables direct access to any element by index, resulting in O(1) complexity. Regardless of the size of the list, accessing an element takes the same amount of time.
🌐
Python
wiki.python.org › moin › TimeComplexity
TimeComplexity - Python Wiki
Note that there is a fast-path ... complexity, but it can significantly affect the constant factors: how quickly a typical program finishes. [1] = These operations rely on the "Amortized" part of "Amortized Worst Case". Individual actions may take surprisingly long, depending on the history of the container. [2] = Popping the intermediate element at index k from a list ...
🌐
Analytics Vidhya
analyticsvidhya.com › home › how can i manipulate python list elements using indexing?
How can I Manipulate Python List Elements Using Indexing?
January 22, 2024 - Direct indexing has a time complexity of O(1), while using the index() method for searching has a time complexity of O(n).
🌐
Finxter
blog.finxter.com › home › learn python blog › python list index() – a simple illustrated guide
Python List index() - A Simple Illustrated Guide - Be on the Right Side of Change
June 19, 2021 - For n elements, the runtime complexity is O(n) because in the worst-case you need to iterate over each element in the list to find that the element does not appear in it. Let’s check the runtime complexity practically for different list sizes ...
🌐
AlgoCademy
algocademy.com › link
Time Complexity Guidelines in Python | AlgoCademy
The code is straightforward and leverages Python's ability to access list elements in constant time. The time complexity of the optimized solution is O(1) because accessing an element by its index in a list is a constant time operation.
Find elsewhere
🌐
Reddit
reddit.com › r/learnpython › does pop(i) have a time complexity of o(n) or o(k)?
r/learnpython on Reddit: Does pop(i) have a Time Complexity of O(n) or O(k)?
July 1, 2020 - For example, as n grows, any fixed negative index value to list.pop() will be O(1), and any fixed non-negative value will be O(n). So 'k' captures the idea that the time-complexity is "parameterized" not by n, but some other variable. ... If you pop the last element it is O(1), if you pop the first element it is O(n). So yes, your understand seems correct. Big O Cheat Sheet: the time complexities of operations Python's data structures
🌐
Quora
quora.com › How-do-Python-lists-maintain-constant-time-complexity-for-indexing-if-their-elements-can-be-of-more-than-one-type
How do Python lists maintain constant time complexity for indexing if their elements can be of more than one type? - Quora
Answer (1 of 4): in a C arrays where the data is held in contiguous memory, you are right that indexing couldn’t be constant time in a heterogeneous container as you would have to sum the widths of all of the previous items before being able to fetch an item (or you would need to keep a separate ...
🌐
Python Morsels
pythonmorsels.com › time-complexities
Python Big O: the time complexities of different data structures in Python - Python Morsels
April 16, 2024 - That's what Python's collections.deque data structure is for. >>> from collections import deque >>> queue = deque([2, 1, 3, 4]) Here are the time complexities of common deque operations: Note that we can efficiently add and remove items from the beginning of a deque with the appendleft and popleft methods. If you find yourself calling the insert or pop methods on a list with an index ...
🌐
Bradfield CS
bradfieldcs.com › algos › analysis › performance-of-python-types
Performance of Python Types
However, the expansion rate is cleverly chosen to be three times the previous size of the array; when we spread the expansion cost over each additional append afforded by this extra space, the cost per append is ... O(1)O(1) on an amortized basis. ... Popping from a Python list is typically performed from the end but, by passing an index, you can pop from a specific position.
🌐
Apps Developer Blog
appsdeveloperblog.com › home › python › python list index()
Python List index() - Apps Developer Blog
January 27, 2023 - The index function finds the match by checking every element of the list until the match is found. Thus, for a smaller list, this is a good choice. But if you are dealing with huge lists and you are not sure whether the match will be found or not, then this function is not. This will increase the time cost of your code. So the longer the list, the more amount of time it will take. To avoid the time complexity, you can narrow down the search by giving the start and end parameters.
🌐
GeeksforGeeks
geeksforgeeks.org › python › complexity-cheat-sheet-for-python-operations
Complexity Cheat Sheet for Python Operations - GeeksforGeeks
July 12, 2025 - Dictionaries in Python are implemented as hash tables, making them highly efficient for key-based operations. Here are the complexities: Note: Defaultdict has operations same as dict with same time complexity as it inherits from dict.
🌐
Analytics Vidhya
analyticsvidhya.com › home › python list index: a guide to finding and manipulating list elements
Python List Index: A Guide to Finding and Manipulating List Elements
January 23, 2024 - It is beneficial when dealing with large lists, as it has a time complexity of O(log n) compared to the linear time complexity of O(n) for sequential search. The list must be sorted in ascending order to use binary search for efficient list indexing.