Program to add two binary numbers using bin function

Program to add two binary numbers using bin function

Program to add two binary numbers using bin function.

A program that combines two binary numbers
In the following program, we use two built-in functions int () and bin ().

The int () function takes into account the source value provided by the given string‌, in the following example we convert the string (which is a binary value) to an integer, so we set the source value to 2 (binary numbers have base 2, decimals have a base value of 10).

After converting strings to integer values. we add them and the result is converted to binary number using bin () function.

Python code: