Contact: aviboots(AT)netvision.net.il
41,443 questions
53,990 answers
573 users
def Count1Bit(n): count = 0 while (n > 0): count += n & 1 n >>= 1 return count n = 95 # 0101 1111 count = Count1Bit(n) print("Number of 1 bit =", count) ''' run: Number of 1 bit = 6 '''