Re: [Tutor] need help with 3.1's fraction module

2010-01-06 Thread Richard D. Moores
On Wed, Jan 6, 2010 at 11:59, bob gailer wrote: > Fraction(str(random())).limit_denominator(100) Thanks! So here's what I wanted to do, or its beginning: == from fractions import Fraction from random import random r = random() print(r) f = str(Fraction(str(r)).limit_denomi

Re: [Tutor] need help with 3.1's fraction module

2010-01-06 Thread bob gailer
Richard D. Moores wrote: from fractions import Fraction Fraction('.83452345').limit_denominator(100) Fraction(81, 97) I'd like to know how to do that in a script, where numbers like .83452345 are the output of random.random(). Fraction(random()).limit_denominator(100) Do

[Tutor] need help with 3.1's fraction module

2010-01-06 Thread Richard D. Moores
>>> from fractions import Fraction >>> Fraction('.83452345').limit_denominator(100) Fraction(81, 97) I'd like to know how to do that in a script, where numbers like .83452345 are the output of random.random(). >>> Fraction(random()).limit_denominator(100) Doesn't work, nor did I really expect it