PythiloEasy · 12 min · Task 27 of 100 · progress kept in this browser

Count set bits

Return the number of 1 bits in a nonnegative integer without converting it to a string.

n = 13
print(bin(n), bin(n & (n-1)))
Your task

Return the number of 1 bits in a nonnegative integer without converting it to a string.