how to do fractions in python code example Example: simplify fractions python >>> from fractions import Fraction >>> Fraction(98, 42) Fraction(7, 3)