IBM interview question

Basic sql query and intermediate python problem.