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.
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