Pregunta de entrevista de Amount

A quite easy python coding question. not leetcode style