for in range( ) [idef test () [for in range( ) append(idef test () [ for in range( )def test () list(range( )to capture the time it takes for each of our functions to execute we will use python' timeit module the timeit module is designed to allow python developers to make cross-platform timing measurements by running functions in consistent environment and using timing mechanisms that are as similar as possible across operating systems to use timeit you create timer object whose parameters are two python statements the first parameter is python statement that you want to timethe second parameter is statement that will run once to set up the test the timeit module will then time how long it takes to execute the statement some number of times by default timeit will try to run the statement one million times when its done it returns the time as floating point value representing the total number of seconds howeversince it executes the statement million times you can read the result as the number of microseconds to execute the test one time you can also pass timeit named parameter called number that allows you to specify how many times the test statement is executed the following session shows how long it takes to run each of our test functions times import the timeit module import timeit import the timer class defined in the module from timeit import timer if the above line is excludedyou need to replace timer with timeit timer when defining timer object timer("test ()""from __main__ import test "print("concat ", timeit(number= )"milliseconds" timer("test ()""from __main__ import test "print("append ", timeit(number= )"milliseconds" timer("test ()""from __main__ import test "print("comprehension ", timeit(number= )"milliseconds" timer("test ()""from __main__ import test "print("list range ", timeit(number= )"milliseconds"concat milliseconds append milliseconds comprehension milliseconds list range milliseconds performance of python data structures