LearnPy Hub
← Classes & Objects problems
Medium

Your Own Fraction Class

Write class Frac storing a numerator and denominator in lowest terms (denominator positive), with __add__ and __str__ (p/q). Read fractions on one line, add them all and print the result. Don't use the fractions module.

Input

One line of fractions like 1/2.

Output

One fraction.

Sample 1

Input
1/2 1/3
Output
5/6

Sample 2

Input
2/4
Output
1/2
solution.py
Output appears here
Your Own Fraction Class · Python practice problem · LearnPy Hub