Hackerrank Python List Comprehension Solution