Skip to content
UPEEC

fractions

Exact rational numbers like 1/3.

Easy
Comments 0
from fractions import Fraction
Fraction(1, 3) + Fraction(1, 6)     # Fraction(1, 2)
Fraction("0.125")                   # Fraction(1, 8)

Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.

Discussion (0)

Sign in or join free to ask questions and discuss this topic.