Time Complexity Of Index Function In Python