Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Based on Forum solution in Clear category for Friendly Number by MrPod
def friendly_number(number, base=1000, decimals=0, suffix='',
powers=['', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']):
i = 0
while abs(number) >= base ** (i + 1) and i + 1 < len(powers):
i += 1
number /= base ** i
if not decimals: number = str(int(number))
else: number = '%.*f' % (decimals, number)
return number + powers[i] + suffix
May 20, 2018