■ Fraction 클래스를 사용해 분수를 연산하는 방법을 보여준다.
▶ 예제 코드 (PY)
1 2 3 4 5 6 7 8 9 10 11 |
from fractions import Fraction fraction = Fraction(3, 4) print(fraction + 1.5) """ 2.25 """ |
■ Fraction 클래스를 사용해 분수를 연산하는 방법을 보여준다.
▶ 예제 코드 (PY)
1 2 3 4 5 6 7 8 9 10 11 |
from fractions import Fraction fraction = Fraction(3, 4) print(fraction + 1.5) """ 2.25 """ |