Fractal interview question

Deep dive into SQL and Python