Python Hamming Weight Leetcode Problem