This comment is reply for 340 匿名: 10/33が{0.3}になるのがどうか・・・(分数を小数に展開). Go to thread root.
匿名 #627(2007/07/12 09:50 GMT) [ Python ] Rating1/1=1.00
自分なりに書き換えてみました。どんなもんでしょう。
1 2 3 4 5 6 7 8 9 10 11
def f(a, b): x = '' h = {a: 0} while 1: i, a = divmod(a * 10, b) x += str(i) if a == 0: return '0.' + x if h.has_key(a): return '0.%s{%s}' % (x[:h[a]], x[h[a]:]) h[a] = len(x)
Rating1/1=1.00-0+
[ reply ]
匿名
#627()
[
Python
]
Rating1/1=1.00
Rating1/1=1.00-0+