InnoBoon interview question

Python basics question and dsa problem