Scientists working internationally use metric units almost exclusively. Unless that is, they wish to crash multimillion dollars worth of equipment on Mars.

Your task is to write a simple function that takes a number of meters, and outputs it using metric prefixes.

In practice, meters are only measured in "mm" (thousandths of a meter), "cm" (hundredths of a meter), "m" (meters) and "km" (kilometers, or clicks for the US military).

For this exercise we just want units bigger than a meter, from meters up to yottameters, excluding decameters and hectometers.

All values passed in will be positive integers.
e.g.

```python
meters(5);
// returns "5m"

meters(51500);
// returns "51.5km"

meters(5000000);
// returns "5Mm"
```

See http://en.wikipedia.org/wiki/SI_prefix for a full list of prefixes

Source: codewars | Difficulty: EASY

Starter code: def meters(x):
	

Solutions:
def meters(x):
	arr = ['', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']
	count = 0
	while x >= 1000:
		x /= 1000.0
		count += 1
	if int(x) == x:
		x = int(x)
	return str(x) + arr[count] + 'm'


PREFIXES = ((10 ** 24, 'Y'), (10 ** 21, 'Z'), (10 ** 18, 'E'), (10 ** 15, 'P'), (10 ** 12, 'T'), (10 ** 9, 'G'), (10 ** 6, 'M'), (10 ** 3, 'k'), (1, ''))

def meters(x):
	(value, prefix) = next((pr for pr in PREFIXES if pr[0] <= x))
	return '%g%sm' % (float(x) / value, prefix)


import math
PREFIXES = ['m', 'km', 'Mm', 'Gm', 'Tm', 'Pm', 'Em', 'Zm', 'Ym']

def meters(x):
	e = int(math.log(x, 1000))
	return '{0:g}{1}'.format(x / 1000.0 ** e, PREFIXES[e])


def meters(x):
	units = [('Y', 24), ('Z', 21), ('E', 18), ('P', 15), ('T', 12), ('G', 9), ('M', 6), ('k', 3), ('', 0)]
	return next((f"{str(x / 10 ** p).replace('.0', '')}{u}m" for (u, p) in units if x // 10 ** p >= 1))


def meters(x):
	(prefix, power) = next((pair for pair in zip('YZEPTGMk', range(24, 0, -3)) if x >= 10 ** pair[1]), ('', 0))
	return '{:g}{}m'.format(x / 10 ** power, prefix)


def meters(x):
	s = ['m', 'km', 'Mm', 'Gm', 'Tm', 'Pm', 'Em', 'Zm', 'Ym']
	i = 0
	while x >= 1000:
		x /= 1000.0
		i += 1
	return '%g%s' % (x, s[i])


from decimal import Context, ROUND_HALF_UP
import re

def meters(num):
	r = len(str(num).strip('0'))
	num = Context(prec=r, rounding=ROUND_HALF_UP).create_decimal(num)
	i = int(num.logb()) // 3
	return re.sub('(\\.0+)(?=[kMGTPEZTY])', '', f"{num.scaleb(-3 * i):f}{' kMGTPEZY'[i]}m".replace(' ', ''))


from math import log

def meters(x):
	prefixes = ['', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']
	order = int(log(x, 1000))
	return '{:g}{}m'.format(x / (1000 ** order or 1), prefixes[order])