Hacker Rank Python Write A Function Solution