Created
May 29, 2018 13:10
-
-
Save Fhernd/eec75ae934085192fc67b29c0562381d to your computer and use it in GitHub Desktop.
Cálculo de fracciones en Python. OrtizOL.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fractions import Fraction | |
fraccion1 = Fraction(2, 3) | |
fraccion2 = Fraction(5, 7) | |
print(fraccion1 + fraccion2) | |
print(fraccion1 * fraccion2) | |
print(fraccion1.numerator) | |
print(fraccion1.denominator) | |
print(float(fraccion2)) | |
numero = 0.5 | |
print(Fraction(*numero.as_integer_ratio())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment