Smart Interview Basic Hackerrank Python Solutions Nested