Get startedGet started for free

Pop quiz: steps for using %mprun

Suppose you have a list of superheroes (named heroes) along with each hero's height (in centimeters) and weight (in kilograms) loaded as NumPy arrays (named hts and wts, respectively). You also have a convert_units() function saved in a file titled hero_funcs.py.

What are the necessary steps you need to take in order to profile the convert_units() function acting on your superheroes data if you'd like to see the line-by-line memory consumption of convert_units()?

This exercise is part of the course

Writing Efficient Python Code

View Course

Hands-on interactive exercise

Turn theory into action with one of our interactive exercises

Start Exercise