# Challenge : 

Write a function that takes a single argument `n` that is a string representation of a simple mathematical expression and evaluates it as a floating point value. 

# Commands : 
- positive or negative decimal numbers
- `+, -, *, /, ( / ).`

---

Expressions use [infix notation](https://en.wikipedia.org/wiki/Infix_notation). 

# Evaluation : 

Operators should be evaluated in the order they appear and not as in `BODMAS`, though brackets __should__ be correctly observed. 

The function should return the correct result for any possible expression of this form.

# Note : 

- All given input will be valid.
- It will consist entirely of numbers or one of the operators.
- Parentheses will alway be matched.
- Use of `eval` or its equivalent is forbidden
- use of `exec` is forbidden (Python) 
- Use of `Function` or any of their (Function, eval) equivalent is also forbidden.
- Using `require` is also forbidden. (`import` for python)
- Using more than 7 (8 for python) lines is also forbidden.
- Using more than 260 (JS) / 240 (python) characters is also forbidden.
- Having more than 100 chars per line is forbidden.
- Having more than 6 semi-colons is forbidden

and that is about it.

--- 

# Examples : 

    e("2*3*4*5+99")               ---> 219
    e("2*3*4*5+99*321-12312312")  ---> -12242013
    e("1-2*2/2*2-1*7+3")          ---> -18

---

Difficulty: EASY
Starter code: def e(s):
	

Solutions:
def e(s):
	return f([*s, '+'])

def f(s, r=0, o=0, x='', c=0):
	while s and ')' != c:
		c = s.pop(0)
		i = '+-*/)('.find(c)
		if c == '-' > x or i < 0:
			x += c
		elif c == '(':
			x = str(f(s))
		elif i > -1:
			a = float(x)
			r = [r + a, r - a, r * a, r / a][o]
			o = i
			x = ''
	return r


def e(s, t=[], x=0, o='+', m=')*+-/'):
	if s:
		t += list(s.replace(' ', '') + ')')
	while o != ')':
		c = t.pop(0)
		if c == '(':
			c = e(0)
		while t[0] not in m:
			c += t.pop(0)
		c = float(c)
		x = {'*': x * c, '+': x + c, '-': x - c, '/': x / c}[o]
		o = t.pop(0)
	return x


def e(p, u=[]):
	if p:
		u += list('0' * (p[0] == '-') + p + ')')
	(a, o, x) = (0, '+', u.pop)
	while o != ')':
		y = x(0)
		c = e(0) if y == '(' else y
		while u[0] not in ')+-*/':
			c += x(0)
		b = float(c)
		a = {'+': a + b, '-': a - b, '*': a * b, '/': a / (b or 1)}[o]
		o = x(0)
	return a


def e(i):
	c = i.find(')')
	if c > 0:
		o = i[:c].rfind('(')
		return e(i[:o] + '{:.9f}'.format(e(i[o + 1:c])) + i[c + 1:])
	v = ''
	r = 0
	p = '+'
	for s in i + p:
		if s in '+-*/' and v:
			w = float(v)
			r = {'+': r + w, '-': r - w, '*': r * w, '/': r / w}[p]
			v = ''
			p = s
		else:
			v += s
	return r


def e(s, l=0, n=0, f='+'):
	if s:
		l = [c for c in s + ')' if ' ' != c]
	while f != ')':
		p = l.pop
		m = p(0)
		if m == '(':
			m = e(0, l)
		while l[0] not in '+-*/)':
			m += p(0)
		m = float(m)
		n = {'+': n + m, '-': n - m, '*': n * m, '/': n / (m or 1)}[f]
		f = p(0)
	return n