Solutions
Use these to check your work after you’ve tried the exercises. If something differs, treat it as a debugging opportunity.
Exercise
B is usually faster because the Python↔C++ boundary is crossed once. In A you pay argument conversion and call overhead 10 million times.