I found an interesting problem on https://www.codewars.com/kata/5274e122fc75c0943d000148:
Finish the solution so that it takes an input `n` (integer) and returns a string that is the decimal representation of the number grouped by commas after every 3 digits.

Assume: `0 <= n < 2147483647`

## Examples

```
       1  ->           "1"
      10  ->          "10"
     100  ->         "100"
    1000  ->       "1,000"
   10000  ->      "10,000"
  100000  ->     "100,000"
 1000000  ->   "1,000,000"
35235235  ->  "35,235,235"
```

I tried it in Python, but could not do it. Can you solve it?
def group_by_commas(n):
    n = [i for i in str(n)]
    for i in range(len(n) -4, -1, -3):
        n.insert(i+1, ',')
    return ''.join(n)