Consecutive Numbers Leetcode Solution Python