Binary Operations @ Dcoder

in #programminglast year

Problem: You will be given two numbers, a and b, in their binary form. You need to print their sum and their product in binary.
Input: Two strings separated by space representing the binary values of a and b.
Output: Print their sum(a+b) in the first line.
Print their product(a*b) in the second line.
Constraints: 1 ≤ string.length ≤ 16
Sample Input: 101 10
Sample Output:
111
1010

a, b = map(lambda s: int(s, 2), input().split())
print(bin(a + b)[2:])
print(bin(a * b)[2:])