How to Solve NameError: name 'choice' is not defined -- random

Solution: Import the 'choice' module

To Solve the error, add the following line to the top of your code.

from random import choice

 

For more information:
Python choice random