Format any integer provided into a string with "," (commas) in the correct places.

**Example:**
``` csharp
Kata.NumberFormat(100000); // return "100,000"
Kata.NumberFormat(5678545); // return "5,678,545"
Kata.NumberFormat(-420902); // return "-420,902"
```
``` javascript
numberFormat(100000); // return '100,000'
numberFormat(5678545); // return '5,678,545'
numberFormat(-420902); // return '-420,902'
```
``` cpp
numberFormat(100000); // return '100,000'
numberFormat(5678545); // return '5,678,545'
numberFormat(-420902); // return '-420,902'
```
``` python
number_format(100000); # return '100,000'
number_format(5678545); # return '5,678,545'
number_format(-420902); # return '-420,902'
```
``` ruby
number_format(100000); # return '100,000'
number_format(5678545); # return '5,678,545'
number_format(-420902); # return '-420,902'
```
``` crystal
number_format(100000); # return '100,000'
number_format(5678545); # return '5,678,545'
number_format(-420902); # return '-420,902'
```

Difficulty: introductory

Starter code:

def number_format(n):
	

Solutions:
def number_format(n):
    return f'{n:,}'

def number_format(n):
    return format(n, ',')

number_format='{:,}'.format

def number_format(n):
    return str('{:,.3f}'.format(n)).rstrip('0').rstrip('.')

import re

def number_format(n):
    return re.sub(r'\B(?=(\d{3})+(?!\d))', r',', str(n))

number_format=lambda n:''.join(','*(i%3==0)+x for i,x in enumerate(str(n)[::-1]))[::-1].replace('-,','-').strip(',')

import re
def number_format(n):
    # converts int to str, reverses it for next step
    n = str(n)[::-1]
    
    # split into groups of 3 digits
    g = re.split(r'(\d{3})', n)
    
    # remove empty string from list
    g = list(filter(None, g))
    
    # special case where "-" is only char in a group and messes up with ",".join()
    if g[-1] == "-":
        return g[-1] + ','.join(g[:-1])[::-1]
    return ','.join(g)[::-1]

def number_format(n):
    
    s = f'{n:,}'
    
    return s



def number_format(n):
  n = [x for x in str(n)]
  if n[0] == "-":
    n = n[1:]
    result = "-"
  else:
    result = ""
  end = []
  while len(n) > 3:
    end.append("".join([","]+n[-3:]))
    n = n[:-3]
  end.append("".join(n))
  for x in end:
    result += end[-1]
    end = end[:-1]
  return result

def number_format(n):
    return f'{n:,.3f}'.rstrip('0').rstrip('.')
    #your code here