Hackerrank python solution example