Yes, you are right, it is O(n) where n – length of list.
Look here for more information: https://www.ics.uci.edu/~pattis/ICS-33/lectures/complexitypython.txt
More Related Contents:
- What is time complexity of a list to set conversion?
- Sliding window maximum in O(n) time
- What is the cost/ complexity of insert in list at some location?
- Accessing the index in ‘for’ loops
- Finding the index of an item in a list
- Get a list of numbers as input from the user
- python list by value not by reference [duplicate]
- Why does this code for initializing a list of lists apparently link the lists together? [duplicate]
- Access multiple elements of list knowing their index
- Comparing two lists using the greater than or less than operator
- Appending the same string to a list of strings in Python
- Removing item from list causes the list to become NoneType
- Why is [] faster than list()?
- How to get first element in a list of tuples?
- How to unzip a list of tuples into individual lists? [duplicate]
- Getting only element from a single-element list in Python?
- Writing a list to a file with Python, with newlines
- How can I convert each item in the list to string, for the purpose of joining them? [duplicate]
- How can I initialize a dictionary of distinct empty lists in Python?
- Removing a list of characters in string
- How to get last items of a list in Python?
- Appending a dictionary to a list in a loop
- Generating all possible combinations of a list, “itertools.combinations” misses some results
- How to read an array of integers from single line of input in python3
- Splitting List That Contains Strings and Integers
- Replace special characters in a string in Python
- List with duplicated values and suffix
- How to group elements in python by n elements [duplicate]
- Unexpected IndexError while removing list items [duplicate]
- How do I reverse a list or loop over it backwards?