Write a function evaluator(op, p, q) to compute simple boolean expressions. The function receives as arguments a string op that is always either ’and’, ’or’ or ’not_or’, and two booleans p and q. The function has to return either the value of the and expression p and q, the value of the or expression p or q or the value of the not_or expression not (p or q) depending on the actual value of op. Hint: Use the python boolean operators and, or and not to define the function.
>>> evaluator('or', False, True) True >>> evaluator('or', 1 == 5, False) False >>> evaluator('and', True, 2 == 3) or evaluator('and', True, False) False >>> evaluator('not_or', 1 == 5, False) True