Run the Code

Run the Code

Home Schooling - Fractions

Oldest daughter has a task to add fractions together, easy I thought.

1/4 + 1/4 is 1/2

I can do this, then I got hit with 11/12 + 5/6

What???

I watched a youtube video and it made a bit of sense, dealing with common denominators, but I wasn't confident enough to be able to mark her work properly so what do I do as programmer?

This

from fractions import Fraction

print(Fraction(11,12)+Fraction(5,6))

Two simple lines and you get the answer in python. My daughter was right and she had to do it the manual way :)

Only another 23 questions to go!!

#python3
 
Share this