Pergunta de entrevista da empresa Amount

A quite easy python coding question. not leetcode style