Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from fractions import Fraction
- a, b = input('Input the numerator and denominator').split()
- a, b = [int(a), int(b)]
- c = a/b
- d = int(c)
- e = d*b
- f = a-e
- g = f/b
- h = Fraction(g).limit_denominator(1000)
- i = int(d)
- if c < 1 : (
- print(str(a) + '/' + str(b) + ' is equal to ' + str(a) + '/' + str(b))
- )
- else: (
- print(str(a) + '/' + str(b) + ' is equal to ' + str(i) + ' ' + str(h))
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement