Log In
NP Code Competition

Simplify It

Back to Problem Listing
Write a function called break_it_down that takes in two numbers that will represent a numerator and a denominator of a fraction. Simplify it into lowest terms and return a tuple (list of size 2) that represents a numerator and denominator of the new fraction in lowest terms. Only positive integers will be used as inputs.

Sample

>>> break_it_down(10, 2)
(5, 1)
>>> break_it_down(12, 16)
(3, 4)
>>> break_it_down(3, 5)
(3, 5)
>>> break_it_down(3, 9)
(1, 3)
This contest has ended. No more answers will be accepted.