Hackerrank Counting Valleys Solution In Python