Hello, tell me, please, how to display a fractional number? For example, 2/7

  • one
    Um, print('2/7') ? - andreymal
  • sympy different formats for outputting formulas supported (ascii, unicode, latex, etc). In jupyter notebook, you can print text and objects beautifully. . - jfs

1 answer 1

 >>> from fractions import Fraction >>> x = Fraction(2,7) >>> x Fraction(2, 7) >>> print x 2/7 >>> >>> x += Fraction(3,5) >>> print x 31/35 >>> 
  • Thank you very much. - Nikita Vinogradov