Dev 2# “To Binary” function (Python)

Let’s create a new function that will convert an integer number into a list of the binary digits that represents the number. Also, we will check alternative syntaxes for our code.

To start with, I am going to create a function called “tobinary” that will accept just one parameter which is going to be the number to be transformed to its binary representation. The data type of this number could be int or str if the number is a string we will transform it to the integer type. We are going to use type annotations later in this note to explicitly restrict the type of…