Day 20 Hackerrank Solution Python