Question: Represent decimal integer values in binary, octal, and hexadecimal number systems and utilize in calculations.Write and test a function that counts and returns the number
Represent decimal integer values in binary, octal, and hexadecimal number systems and utilize in calculations.Write and test a function that counts and returns the number of bits set to 1 in a positive integer. For example, countBits(12) should return 2 because 12 = 1100. Add code to your countBits method so that it returns both the number of 1 bits in the integer and a string representation of the integer.For example, statement: print(countBits(12)) should display the the following image 
Explain every step of the code.
Process finished with exit code
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
