[Python]
Design a class ‘fractions’ so that the fr
[Python] Design a class ‘fractions’ so that the fractions can be directly added and subtracted like integers. For example, 2/1+3/5=13/5, and make sure that the numerator and denominator do not have a common factor greater than 1.(hint: overwrite __str__, __add__, __sub__ methods)…… 请问怎么确保分子分母的因数只有1呀~