Question: I'm trying to create this simple logic whereas I want the array value to add to the previous value. For example the code below, the 18 should carry the 1 and add to the the 9 and the 9 will be 10 then carry the one and add to the 7 and will be 8 and so on. I think I'm on the right track but I can't figure out the rest.

This is for addition math generator I'm working on.

```
var foo = [7, 9, 18];
var bar =  foo.map(i=>{
  return i % 10
})

console.log(bar) // [7,9,8]  I want it to be [8,0,8]

```

Answer: 
You appear to have parenthesis out of place.

`arr2.append(''+str(int(n)+' ' + str(int(m)+'')`

should be

`arr2.append(''+str(int(n))+' ' + str(int(m))+'')`
In line `25` change `'arr2.append(''+str(int(n)+' ' + str(int(m)+'')'` to `arr2.append(''+str(int(n)) +' ' + str(int(m))+'')`

**Note** : after i runned your code i see a error 

```
 n=(((6 * foo) - (m * (m + 1) * (2 * m + 1))) / (3 * ((m * m) + m))) + m

ZeroDivisionError: division by zero

```

That's because you use `foo =100` (in line 13) and then use `n = foo` So after `for m in range(n):` the loop will started with `0`

so m is zero now ! and in 

```
n=(((6 * foo) - (m * (m + 1) * (2 * m + 1))) / (3 * ((m * m) + m))) + m

```

your program will throw an exception 

So for Fixing this part you can change `for m in range(n):` to

```
 for m in range(1 ,n):

```