How to Solve NameError: name 'decimal' is not defined

Solution: Import the 'decimal' module

# Add the following line to the top of your code
import decimal

 

For more information:
Python decimal