Why does my code not print the base 10 equivalent of the binary string?


#1

Question

Why does my code not print the base 10 equivalent of the binary string?

Answer

There are two parts you need to do correctly to print the base 10 equivalent of the binary number 11001001.

  1. We must provide the first parameter as the string of the binary number we want to convert
  2. We must provide the second parameter as the base we’re currently giving as the first parameter, which is 2 in this case

FAQ: Learn Python - Introduction to Bitwise Operators - int()'s Second Parameter