Capgemini interview question

Sql questions on window function Python - basic code