add_binary.py 171 B

1234567
  1. def addBinary(a: str, b: str) -> str:
  2. a_num = int(a, 2)
  3. b_num = int(b, 2)
  4. result = a_num + b_num
  5. return (bin(result)[2:])
  6. print(addBinary('1010', '1011'))