Working through HackerRank problems in Python