In this kata you need to write a function that will receive two strings (```n1``` and ```n2```), each representing an integer as a binary number. A third parameter will be provided (```o```) as a string representing one of the following operators: add, subtract, multiply.

Your task is to write the calculate function so that it will perform the arithmetic and the result returned should be a string representing the binary result.

Examples:
```
1 + 1 === 10
10 + 10 === 100
```

Negative binary numbers are usually preceded by several 1's. For this kata, negative numbers can be represented with the negative symbol at the beginning of the string.

Examples of negatives:
```
1 - 10 === -1
10 - 100 === -10
```

Difficulty: introductory

Starter code:

def calculate(n1, n2, o):
	

Solutions:
def calculate(n1, n2, o):
    operators = {
        "add": (lambda x, y: x + y),
        "subtract": (lambda x, y: x - y),
        "multiply": (lambda x, y: x * y),
    }
    
    return "{:b}".format( operators[o]( int(n1, 2), int(n2, 2) ) )

def calculate(n1, n2, o):
    def s2b(i):
        return int(i, base=2)
    
    if o == 'add':
        res = s2b(n1) + s2b(n2)
    elif o == 'subtract':
        res = s2b(n1) - s2b(n2)
    elif o == 'multiply':
        res = s2b(n1) * s2b(n2)
    
    return '{0:b}'.format(res)

def calculate(n1, n2, o):
    ops = {
        "add": (lambda a, b: a + b), 
        "subtract": (lambda a, b: a - b), 
        "multiply": (lambda a, b: a * b)}
    n = ops[o](int(n1, 2), int(n2, 2))
    s = str(bin(n))
    return  "-" + s[3:] if n < 0 else s[2:]

from operator import add, sub as subtract, mul as multiply

def calculate(n1, n2, o):
    value = globals()[o](int(n1, 2), int(n2, 2))
    return format(value, 'b')

from operator import *
def calculate(n1, n2, o):
    result = eval(o[:3])(int(n1, 2), int(n2, 2))
    return (bin(result)[2:], bin(result)[0] + bin(result)[3:])[result < 0]


import operator
def calculate(n1, n2, o):
    calc = {
        'add':operator.add((int(n1, base=2)),(int(n2, base=2))), 
        'subtract':operator.sub((int(n1, base=2)),(int(n2, base=2))), 
        'multiply':operator.mul((int(n1, base=2)),(int(n2, base=2))) }
    return '{:b}'.format(calc[o])

op = { "add" : (lambda x, y : "{:b}".format(int(x,2) + int(y,2))),
       "subtract" : (lambda x, y : "{:b}".format(int(x,2) - int(y,2))),
       "multiply" : (lambda x, y : "{:b}".format(int(x,2) * int(y,2))) }

def calculate(n1, n2, o):
    return op[o](n1, n2)


def calculate(n1, n2, o):
    if o == 'add': return bin(int(n1,2) + int(n2,2))[2:]
    if o == 'subtract': 
        result = bin(int(n1,2) - int(n2,2))
        if result[0] == '-':
            return result[0] + result[3:]
        return result[2:]
    if o == 'multiply': return bin(int(n1,2) * int(n2,2))[2:]
    if o == 'divide': return bin(int(n1,2) / int(n2,2))[2:]

def calculate(n1, n2, o):
    return bin(int(n1, 2) + int(n2, 2) if o == 'add' else int(n1, 2) - int(n2, 2) if o == 'subtract' else int(n1, 2) * int(n2, 2)).replace('0b', '')