The Fine Print
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
- Seniority
- mid
Problem
A trade-surveillance system screens transaction `records` against a `query`, a predicate tree whose leaf nodes compare one field to a value with `>`, `>=`, `<`, `<=`, `==`, or `!=`, and whose interior nodes nest `and`, `or`, and `not` to any depth. Return the records that satisfy the whole tree, keeping them in their original order. A leaf comparison is false for any record that lacks the field it names.
Summary
Risk rules nest deep. Decide which transactions clear them.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.