Python Timer Functions: Three Ways to Monitor Your Code Quiz

Interactive Quiz ⋅ 13 Questions
By Joseph Peart

In this quiz, you’ll test your understanding of Python Timer Functions: Three Ways to Monitor Your Code.

By working through this quiz, you’ll revisit why time.perf_counter() is the go-to clock for timing code and how to wrap a timer in a class, a context manager, and a decorator. You’ll also review timeit and cProfile for benchmarking and profiling your programs.

The quiz contains 13 questions and there is no time limit. You’ll get 1 point for each correct answer. At the end of the quiz, you’ll receive a total score. The maximum score is 100%. Good luck!

Related Resources

Python Timer Functions: Three Ways to Monitor Your Code

Course

Python Timer Functions

Learn how to time your Python code with the time module, then build a reusable Timer class that works as a context manager.

intermediate python stdlib

Python Timer Functions: Three Ways to Monitor Your Code

Tutorial

Python Timer Functions: Three Ways to Monitor Your Code

In this step-by-step tutorial, you'll learn how to use Python timer functions to monitor how quickly your programs are running. You'll use classes, context managers, and decorators to measure your program's running time. You'll also learn the benefits of each method and which to use given the situation.

intermediate python stdlib