How to Solve NameError: name 'Fraction' is not defined -- fractions
Solution: Import the 'Fraction' module
To Solve the error, add the following line to the top of your code.
from fractions import Fraction
For more information:
Python fractions Fraction