Count Set Bits

In a binary number, you only see zeroes and ones, and sometimes you need to count the positions that are switched on. The function egg_count receives display_value and returns the number of 1 bits in its binary representation. For example, if the binary form contains four ones, the result should be 4.

Примеры

Ввод
0
Вывод
0
Ввод
16
Вывод
1
Ввод
89
Вывод
4

Нужно реализовать

def egg_count(display_value: int) -> int:

Теги

math
PostgreSQLv16
Entre para enviar

O resultado da execução do código aparecerá aqui

Visible tests
1
Input
0
Expected0
2
Input
16
Expected1
3
Input
89
Expected4
4
Input
2000000000
Expected13
5
Input
255
Expected8
6
Input
999999
Expected12
Focus radio
Paused · SomaFM · Fluid