Python‎ > ‎fractions‎ > ‎

fractions.Fraction()

http://www.adilwaseem.com/

Introduction
In the two-argument form of the constructor, Fraction will produce a rational number . Both argument both be rational number.

Syntax
fractions.Fraction(x,y)

Parameters
x, y=number

Example
The equal to:
from fractions import Fraction
a=Fraction(5,16)
b=Fraction(9,16)
c=a+b
print(c)

>>> 
7/8
>>>

Comments