What goes in the blank?
# number of 1 bits: 13 (0b1101) -> 3 ones = n.____()
Answer: bit_count
int.bit_count (Python 3.10+) returns the population count, the number of set bits.
Play Problem Solving ▸
# number of 1 bits: 13 (0b1101) -> 3 ones = n.____()
Answer: bit_count