python 计算器 分数计算
今天算概率的时候想偷懒
于是:
from fractions import Fraction a = Fraction(1, 2) b = Fraction(1, 3) c = Fraction(1, 5) ab = Fraction(1, 10) ac = Fraction(1, 15) bc = Fraction(1, 20) abc = Fraction(1, 30) print(a + b + c - ab - ac - bc + abc)
今天算概率的时候想偷懒
于是:
from fractions import Fraction a = Fraction(1, 2) b = Fraction(1, 3) c = Fraction(1, 5) ab = Fraction(1, 10) ac = Fraction(1, 15) bc = Fraction(1, 20) abc = Fraction(1, 30) print(a + b + c - ab - ac - bc + abc)
相关推荐