Search the courses, subjects, tracks, games and features, or jump straight to a page.
3 cards from this section. Quick, good the night before a test.
What is the primary purpose of the timeit module?
Think about performance measuring in Python.
How would you use the timeit module to measure the time a simple addition takes?
Remember the syntax involves passing a code string.
What is a primary advantage of the timeit module?
Think about minimizing variability when testing time.
Using the timeit module with a decorator keeps your code:
Consider what decorators do in Python.
Devise a way to use the timeit module to benchmark the performance of a plain list versus a numpy array over the same operation of summing elements.
Consider how to set up both environments in your testing.
Create a function that will aggregate and return execution times of different functions being measured with timeit.
Think about using a loop to iterate function calls and aggregate the results.
5 more questions in this section. Enroll free to practise them all.
Enroll free