Your task is to create a function that does four basic mathematical operations.

The function should take three arguments - operation(string/char), value1(number), value2(number).  
The function should return result of numbers after applying the chosen operation.

### Examples

```python
basic_op('+', 4, 7)         # Output: 11
basic_op('-', 15, 18)       # Output: -3
basic_op('*', 5, 5)         # Output: 25
basic_op('/', 49, 7)        # Output: 7
```

Difficulty: EASY
Tags: Fundamentals

Mathematics

Starter code:
def basic_op(operator, value1, value2):
	

Solutions:
def basic_op(operator, value1, value2):
	if operator == '+':
		return value1 + value2
	if operator == '-':
		return value1 - value2
	if operator == '/':
		return value1 / value2
	if operator == '*':
		return value1 * value2


def basic_op(operator, value1, value2):
	return eval('{}{}{}'.format(value1, operator, value2))


def basic_op(operator, value1, value2):
	return eval(str(value1) + operator + str(value2))


def basic_op(o, a, b):
	return {'+': a + b, '-': a - b, '*': a * b, '/': a / b}.get(o)


def basic_op(operator, value1, value2):
	if operator == '+':
		return value1 + value2
	elif operator == '-':
		return value1 - value2
	elif operator == '*':
		return value1 * value2
	elif operator == '/':
		return value1 / value2
	else:
		print('Unrecognized Operator. Abort.')


def basic_op(operator, value1, value2):
	return eval(f'{value1}{operator}{value2}')


def basic_op(operator, value1, value2):
	ops = {'+': lambda a, b: a + b, '-': lambda a, b: a - b, '*': lambda a, b: a * b, '/': lambda a, b: a / b}
	return ops[operator](value1, value2)


def basic_op(op, v1, v2):
	return v1 + v2 if op == '+' else v1 - v2 if op == '-' else v1 * v2 if op == '*' else v1 / v2


def basic_op(operator, value1, value2):
	if operator == '+':
		result = value1 + value2
	if operator == '-':
		result = value1 - value2
	if operator == '*':
		result = value1 * value2
	elif operator == '/':
		result = value1 / value2
	return result


def basic_op(operator, value1, value2):
	if operator == '+':
		return value1 + value2
	elif operator == '-':
		return value1 - value2
	elif operator == '*':
		return value1 * value2
	else:
		return value1 / value2


def basic_op(operator, value1, value2):
	op = {'+': value1 + value2, '-': value1 - value2, '*': value1 * value2, '/': value1 / value2}
	return op[operator]


def basic_op(operator, x, y):
	if operator == '+':
		return x + y
	if operator == '-':
		return x - y
	if operator == '*':
		return x * y
	if operator == '/':
		return x / y


basic_op = lambda o, v1, v2: __import__('operator').__dict__[{'+': 'add', '-': 'sub', '*': 'mul', '/': 'truediv'}[o]](v1, v2)


def basic_op(operator, value1, value2):
	dict = {'+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: x / y}
	return dict[operator](value1, value2)


import operator

def basic_op(op, value1, value2):
	oper = {'+': operator.add, '-': operator.sub, '*': operator.mul, '/': operator.truediv}
	return oper[op](value1, value2)


def basic_op(*sheeps):
	hungry_wolf_eats = eval
	sheeps_in_order = '{1}{0}{2}'.format(*sheeps)
	return hungry_wolf_eats(sheeps_in_order)


def basic_op(o, v1, v2):
	if o == '+':
		return v1 + v2
	elif o == '-':
		return v1 - v2
	elif o == '*':
		return v1 * v2
	elif o == '/':
		return v1 / v2
	else:
		return 'not recognized'


import operator

def basic_op(operatorchar, value1, value2):
	return {'+': operator.add, '-': operator.sub, '*': operator.mul, '/': operator.truediv, '%': operator.mod, '^': operator.xor}[operatorchar](value1, value2)


def basic_op(operator, value1, value2):
	if operator == '+':
		return value1 + value2
	elif operator == '-':
		return value1 - value2
	elif operator == '*':
		return value1 * value2
	elif operator == '/':
		return value1 / value2 if value2 != 0 else value1
	return None


def basic_op(operator, value1, value2):
	e = '%s %s %s' % (value1, operator, value2)
	return eval(e)


def basic_op(op, x, y):
	if op == '+':
		return x + y
	elif op == '-':
		return x - y
	elif op == '*':
		return x * y
	else:
		return x / y


basic_op = lambda o, v1, v2: eval('{}{}{}'.format(v1, o, v2))


def basic_op(operator, value1, value2):
	a = int(value1)
	b = int(value2)
	if operator == '+':
		output = a + b
	elif operator == '-':
		output = a - b
	elif operator == '*':
		output = a * b
	else:
		output = a / b
	return output


basic_op = lambda o, a, b: eval(str(a) + o + str(b))


def basic_op(o, v1, v2):
	return eval(str(v1) + o + str(v2))


def basic_op(operator, value1, value2):
	op = {'+': int.__add__, '-': int.__sub__, '*': int.__mul__, '/': int.__truediv__}
	return op[operator](value1, value2)


basic_op = lambda o, v1, v2: eval(f'{v1}{o}{v2}')


def basic_op(operator, value1, value2):
	if operator == '+' and type(value1) == int and (type(value2) == int):
		return value1 + value2
	if operator == '-':
		return value1 - value2
	if operator == '*':
		return value1 * value2
	else:
		return value1 / value2


operations = {'*': lambda value1, value2: value1 * value2, '-': lambda value1, value2: value1 - value2, '/': lambda value1, value2: value1 / value2, '+': lambda value1, value2: value1 + value2}

def basic_op(operator, value1, value2):
	return operations[operator](value1, value2)


basic_op = lambda o, v1, v2: int.__dict__[{'+': '__add__', '-': '__sub__', '*': '__mul__', '/': '__truediv__'}[o]](v1, v2)


basic_op = lambda o, a, b: eval(f'{a}{o}{b}')


from operator import add, sub, truediv, mul

def basic_op(operator, v1, v2):
	op = {'+': add, '-': sub, '*': mul, '/': truediv}
	return op[operator](v1, v2)


from operator import add, sub, mul, truediv
OPS = {'+': add, '-': sub, '*': mul, '/': truediv}

def basic_op(op, a, b):
	return OPS[op](a, b)


import operator
from functools import reduce

def basic_op(operator_mark, value1, value2):
	d = {'+': operator.add, '-': operator.sub, '*': operator.mul, '/': operator.truediv}
	return d[operator_mark](value1, value2)


def basic_op(operator, value1, value2):
	return {'+': value1 + value2, '-': value1 - value2, '*': value1 * value2, '/': value1 / value2}.get(operator)


def basic_op(o, v1, v2):
	return eval('{}{}{}'.format(v1, o, v2))


def basic_op(operator, value1, value2):
	return eval('{0} {1} {2}'.format(value1, operator, value2))


def basic_op(operator, value1, value2):
	if operator == '+':
		return value1 + value2
	elif operator == '-':
		return value1 - value2
	elif operator == '*':
		return value1 * value2
	elif operator == '/':
		return value1 / value2
	else:
		print("I don't recognize " + str(operator) + ' as an operator.')


def basic_op(operator, value1, value2):
	return eval('{val1}{operator}{val2}'.format(val1=value1, operator=operator, val2=value2))


def basic_op(operator, v1, v2):
	if operator == '+':
		a1 = v1 + v2
	elif operator == '-':
		a1 = v1 - v2
	elif operator == '*':
		a1 = v1 * v2
	elif operator == '/':
		a1 = v1 / v2
	else:
		print('You have not typed a valid operator, please run the program again.')
	return a1


def basic_op(operator, value1, value2):
	if operator == '+':
		result = value1 + value2
	elif operator == '-':
		result = value1 - value2
	elif operator == '*':
		result = value1 * value2
	elif operator == '/':
		result = value1 / value2
	else:
		result = None
	return result


def basic_op(operator, value1, value2):
	if operator == '+':
		res = value1 + value2
		return res
	elif operator == '-':
		res = value1 - value2
		return res
	elif operator == '*':
		res = value1 * value2
		return res
	elif operator == '/':
		res = value1 / value2
		return res
	else:
		print('Use only (+ - * /) functions')


def basic_op(oper, a, b):
	return [a + b, a - b, a * b, a / b][(oper == '-') + 2 * (oper == '*') + 3 * (oper == '/')]


def basic_op(operator, value1, value2):
	calc = {'+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: x / y}
	return calc[operator](value1, value2)


from operator import add, sub, mul, truediv

def basic_op(operator, value1, value2):
	ops = {'+': add, '-': sub, '*': mul, '/': truediv}
	return ops.get(operator)(value1, value2)


import operator as op

def basic_op(operator, value1, value2):
	op_dict = {'+': op.add, '-': op.sub, '*': op.mul, '/': op.truediv}
	return op_dict[operator](value1, value2)


def basic_op(operation, value1, value2):
	if operation == '+':
		return value1 + value2
	elif operation == '-':
		return value1 - value2
	elif operation == '*':
		return value1 * value2
	else:
		return value1 / value2
print(basic_op('+', 4, 7))
print(basic_op('-', 15, 18))
print(basic_op('*', 5, 5))
print(basic_op('/', 49, 7))


def basic_op(operator, value1, value2):
	if operator[0] == '+':
		return value1 + value2
	elif operator[0] == '-':
		return value1 - value2
	elif operator[0] == '*':
		return value1 * value2
	elif operator[0] == '/':
		return value1 / value2


def basic_op(operator, value1, value2):
	if operator == '+':
		return value1 + value2
	elif operator == '-':
		return value1 - value2
	elif operator == '*':
		return value1 * value2
	elif operator == '/':
		return value1 / value2
	else:
		print('invalid operation')


def basic_op(operator, value1, value2):
	if operator in '+':
		return value1 + value2
	elif operator in '-':
		return value1 - value2
	elif operator in '*':
		return value1 * value2
	elif operator in '/':
		return value1 / value2
	else:
		pass


def basic_op(operator, value1, value2):
	arr = [str(value1), operator, str(value2)]
	return eval(''.join(arr))


def basic_op(operator, value1, value2):
	ops = {'+': lambda x, y: x + y, '-': lambda x, y: x - y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: x / y}
	return ops[operator](value1, value2)


def basic_op(operator, value1, value2):
	if operator == '+':
		x = lambda a, b: a + b
		return x(value1, value2)
	if operator == '-':
		x = lambda a, b: a - b
		return x(value1, value2)
	if operator == '*':
		x = lambda a, b: a * b
		return x(value1, value2)
	if operator == '/':
		x = lambda a, b: a / b
		return x(value1, value2)


def basic_op(operator, value1, value2):
	switch = {'+': value1 + value2, '-': value1 - value2, '*': value1 * value2, '/': value1 / value2}
	return switch.get(operator, 'Invalid Operator')


def basic_op(operator, value1, value2):
	p = '-'
	s = '+'
	r = '*'
	e = '/'
	if p in operator:
		return value1 - value2
	elif s in operator:
		return value1 + value2
	elif r in operator:
		return value1 * value2
	elif e in operator:
		return value1 / value2


basic_op = lambda o, v, w: {'+': lambda a, b: a + b, '-': lambda a, b: a - b, '*': lambda a, b: a * b, '/': lambda a, b: a / b}[o](v, w)


def basic_op(operator, value1, value2):
	if operator == '+':
		return value1 + value2
	elif operator == '*':
		return value1 * value2
	elif operator == '/':
		return value1 / value2
	elif operator == '-':
		return value1 - value2
print(basic_op('*', 7, 6))


def basic_op(operator, value1, value2):
	multiplication = value1 * value2
	division = value1 / value2
	addition = value1 + value2
	subtraction = value1 - value2
	result = 0
	if operator == '*':
		result = multiplication
	if operator == '/':
		result = division
	if operator == '+':
		result = addition
	if operator == '-':
		result = subtraction
	return result


def basic_op(op, v1, v2):
	if op == '+':
		return v1 + v2
	elif op == '-':
		return v1 - v2
	elif op == '*':
		return v1 * v2
	elif op == '/':
		return float(v1 / v2)


def basic_op(operator, v1, v2):
	if operator == '+':
		return v1 + v2
	elif operator == '-':
		return v1 - v2
	elif operator == '*':
		return v1 * v2
	elif operator == '/':
		return v1 / v2
	else:
		return -1


def basic_op(operator, value1, value2):
	if operator == '+':
		answer = int(value1) + int(value2)
	elif operator == '-':
		answer = int(value1) - int(value2)
	elif operator == '*':
		answer = int(value1) * int(value2)
	else:
		answer = int(value1) / int(value2)
	return answer


def basic_op(op, num1, num2):
	if op == '*':
		return num1 * num2
	elif op == '+':
		return num1 + num2
	elif op == '/':
		return num1 / num2
	elif op == '-':
		return num1 - num2


def basic_op(operator, value1, value2):
	if operator == '+':
		return value1 + value2
	elif operator == '-':
		return value1 - value2
	elif operator == '*':
		return value1 * value2
	elif operator == '/':
		return value1 / value2
	else:
		return 'invalid operator'
print(basic_op('+', 1, 2))


def basic_op(operator, value1, value2):
	x = (str(value1), operator, str(value2))
	x = eval(''.join(x))
	return x


def basic_op(*a):
	return eval('{1}{0}{2}'.format(*a))


def basic_op(operator, value1, value2):
	k = {'+': value1 + value2, '-': value1 - value2, '*': value1 * value2, '/': value1 / value2}
	return k[operator]


def basic_op(op, x, y):
	if op == '+':
		a = x + y
	elif op == '-':
		a = x - y
	elif op == '*':
		a = x * y
	elif op == '/':
		a = x / y
	return a


def basic_op(operator, value1, value2):

	def div(a, b):
		return a / b
	operations_mapping = {'+': int.__add__, '-': int.__sub__, '*': int.__mul__, '/': div}
	return operations_mapping[operator](value1, value2)


def basic_op(operator, v1, v2):
	if operator == '-':
		new = v1 - v2
	elif operator == '+':
		new = v1 + v2
	elif operator == '*':
		new = v1 * v2
	else:
		new = v1 / v2
	return new


def basic_op(operator, value1, value2):
	if operator == '+':
		summary = value1 + value2
		return summary
	if operator == '-':
		summary = value1 - value2
		return summary
	if operator == '*':
		summary = value1 * value2
		return summary
	if operator == '/':
		summary = value1 / value2
		return summary
	return None


def _sum(value1, value2):
	return value1 + value2

def _substract(value1, value2):
	return value1 - value2

def _multiply(value1, value2):
	return value1 * value2

def _divide(value1, value2):
	return value1 / value2
OPERATORS_MAP = {'+': _sum, '-': _substract, '*': _multiply, '/': _divide}

def basic_op(operator, value1, value2):
	result = OPERATORS_MAP[operator](value1, value2)
	return result


def basic_op(operator, value1, value2):
	operator == str(operator)
	value1 == float(value1)
	value2 == float(value2)
	if operator == '+':
		addition = float(value1 + value2)
		return addition
	elif operator == '-':
		return value1 - value2
	elif operator == '*':
		return value1 * value2
	else:
		division = value1 / value2
		return division


def basic_op(operator, a, b):
	return a + b if operator == '+' else a - b if operator == '-' else a * b if operator == '*' else a / b


def basic_op(op, v1, v2):
	if op == '/' and v2 == 0:
		return 'Error! Division by zero!'
	if op not in '+-*/':
		return 'Error! Wrong operator!'
	if op == '+':
		return v1 + v2
	if op == '-':
		return v1 - v2
	if op == '*':
		return v1 * v2
	return v1 / v2


import operator

def basic_op(operator, value1, value2):
	s = str(value1) + operator + str(value2)
	return eval(s)