Consecutive Subsequences Solution In Python