Pregunta de entrevista de IBM

Solve the following Python question?