Factspan Interview Question

SQL query, python logical questions