SLB interview question

Python programming language logical question