EY Interview Question

Python related and SQL queries: