Question: I'm trying to make a calculator for something, but the formulas use a sigma, I have no idea how to do a sigma in python, is there an operator for it?
Ill put a link here with a page that has the formulas on it for illustration:<http://fromthedepths.gamepedia.com/User:Evil4Zerggin/Advanced_cannon>

Answer: 
An efficient way to do this in Python is to use [`reduce()`](https://docs.python.org/3/library/functools.html#functools.reduce).

To solve

```none
3
Σ i
i=1

```

You can use the following:

```
from functools import reduce
result = reduce(lambda a, x: a + x, [0]+list(range(1,3+1)))
print(result)

```

`reduce()` will take arguments of a callable and an iterable, and return one value as specified by the callable. The accumulator is `a` and is set to the first value (`0`), and then the current sum following that. The current value in the iterable is set to `x` and added to the accumulator. The final accumulator is returned.

The formula to the right of the sigma is represented by the lambda. The sequence we are summing is represented by the iterable. You can change these however you need.

For example, if I wanted to solve:

```none
Σ π*i^2
i

```

For a sequence I `[2, 3, 5]`, I could do the following:

```
reduce(lambda a, x: a + 3.14*x*x, [0]+[2,3,5])

```

You can see the following two code lines produce the same result:

```
>>> reduce(lambda a, x: a + 3.14*x*x, [0]+[2,3,5])
119.32
>>> (3.14*2*2) + (3.14*3*3) + (3.14*5*5)
119.32

```
```
import numpy as np

def sigma(s,e):
  x = np.arange(s,e)
  return np.sum([x+1])

```