BNP Paribas interview question

Code in python and sql sharing your screen