still learning Python so any help is welcome.
I have written a funtion to get a fraction, but more often than not the fraction can be simplified. My code does not do this yet. Any ideas how to simplify the fraction without using any import
functions?
code:
def add_frac(n1, d1, n2, d2):
frac = (((n1 * d1) + (n2 * d2)), (d1 * d2))
return frac
example:
add_frac(1, 2, 1, 4)
gives (6, 8)
in stead of (3, 4)
Any help is welcome!