Leetcode Count Set Bits In Python Iteration