I have a little problem with randomly generated statements in Python 3.
import operator
hardOperators = [operator.add, operator.sub, operator.mul]
random_hardOperator = random.choice(hardOperators)
So you see that I have operator functions add, suband mul. But when I try to add a statement div, I get a message saying that operator has no attribute 'div'.
I had never tried using random operators in Python before, so this may seem like a dumb question, but this is the one that gives me hell in debugging.
source
share