Statistics, Machine Learning, Data Science, Central Limit Theorem, Sample.
1000: return str(n) if commas: return f"{n:,}" else: names = ['', 'thousand', 'million', 'billion', 'trillion', 'quadrillion'] n = float(n) idx = max(0,min(len(names)-1, int(math.floor(0 if n == 0 else math.log10(abs(n))/3)))) return f'{n/10**(3*idx):.{decimals}f} {names[idx]}' def