Algorithm · Stripe · Hard
Problem Build a rule engine for assessing transactions. You receive a dictionary of transaction fields and an ordered list of rules, and you must print either accept or block. The problem unfolds in three stages: Handle conditions that test string equality. The first rule whose condition holds decides the outcome; if no rule holds, the result is accept. Add Boolean conditions together with AND/OR. Be careful that a string value which happens to contain the word and is never…