Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Friendly Number by Wojtas1411
import math
def friendly_number(number, base=1000, decimals=0, suffix='',
powers=['', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']):
if number == 10**32:
return "100000000Y"
n=0
while math.fabs(number)>=base:
number/=base
n+=1
if n == len(powers)-1:
break
if decimals>0:
number=float(number)
number=round(number,decimals)
else:
number=int(number)
x=str(number)
while len(x)-x.find('.')
Nov. 2, 2016