Simple evaluator

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.

Sample session

Problem information

Author: ProAl

Generation: 2026-01-25T14:22:08.786Z

© Jutge.org, 2006–2026.
https://jutge.org
