What is the time complexity of the sum() function?
It depends on your data structure. For a flat list, you cannot do better than O(n) because you have to look at each item in the list to add them up.
When in doubt, try it out: import profile is your friend.
What is the time complexity of sum() in Python?