DIY: Add Binary

Problem statement

In this challenge, you are given two binary numbers as strings. Implement a function that takes these strings as input, performs the binary addition, and returns the output in the form of a string.

Input

The inputs will be two binary numbers in the form of strings called a and b. For example, consider the following inputs:

a = "1010100"
b = "0100011"

Output

The function will return a string that represents the binary number calculated by the addition of the inputs. The following is the output for the inputs mentioned above is given below:

"1110111"

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy