I need to reverse a list in python3 using the function below:
def flip(arr): arr = arr[::-1] return arr I would like to know what the runtime for this function is.
using timeit module
timeit.timeit(stmt='pass', setup='pass', timer=, number=1000000)
>>? def flip(arr): arr = arr[::-1] return arr >>? import timeit >>? timeit.timeit('__main__.flip(range(10000))', 'import __main__', number=1) 0.0005059589886400317
O(n)(stack overflow wont let me post a comment less than 15 chars)