Module: (Python) Subroutines: Procedures and Functions - 2


Problem

3/8

The number of units in the binary notation of a number

Problem

Write a function that calculates, given a number N in decimal notation, the number of ones in the binary representation of this number (0 <= N <= 106)
 
Examples
# Input Output
1 255 8