import fractions f1 = fractions.Fraction(2, 3) f2 = fractions.Fraction(3, 7) print('{} + {} = {}'.format(f1, f2, f1 + f2)) print('{} - {} = {}'.format(f1, f2, f1 - f2)) print('{} * {} = {}'.format(f1, f2, f1 * f2)) print('{} / {} = {}'.format(f1, f2, f1 / f2))
python 分数的数学四则运算
猜你喜欢
转载自www.cnblogs.com/sea-stream/p/9966034.html
今日推荐
周排行