Hackerrank Solution For Python List