while True:
try:
s= int(input())
s=bin(s)
print(s.count('1'))
except:
break
python种用bin(number)可直接转换为2进制
while True:
try:
s= int(input())
s=bin(s)
print(s.count('1'))
except:
break
python种用bin(number)可直接转换为2进制