Given accessCodes = {XYZ, ABC, LMN, TUV...} and the postfix rule = "XYZ ABC AND XNN OR LMN NOT AND", return either true or false.
Asked in the technical phone screen stage. Implement evaluate_access_rule(accessCodes, rule).
accessCodes is a list of strings. rule is a space-separated postfix expression containing access-code names and the operators AND, OR, and NOT. A code evaluates to true when it appears in accessCodes; unknown codes evaluate to false. Return the resulting boolean. The expression is valid and contains at least one operand.
AND, OR, and NOTdef evaluate_access_rule(accessCodes, rule):