Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Challenge: Automated Transaction Screening | Automating Compliance Checks
Practice
Projects
Quizzes & Challenges
Quizze
Challenges
/
Python for Compliance Officers
Abschnitt 1. Kapitel 5
single

single

bookChallenge: Automated Transaction Screening

Swipe um das Menü anzuzeigen

Automating transaction screening is a core use case for Python in compliance operations. By leveraging Python’s ability to process lists and apply logic, you can efficiently check transactions against multiple rules—such as amount thresholds and blacklisted accounts—without manual review. This approach ensures consistent, fast, and auditable screening of financial activity, helping you meet regulatory requirements and reduce the risk of oversight.

1234567891011121314151617181920
def screen_transactions(transactions, blacklist, threshold): flagged = [] for tx in transactions: # Write your code here pass return flagged transactions = [ {"id": 1, "amount": 12000, "account_id": "A123", "timestamp": "2024-06-01T10:00:00"}, {"id": 2, "amount": 500, "account_id": "B456", "timestamp": "2024-06-01T11:00:00"}, {"id": 3, "amount": 25000, "account_id": "X999", "timestamp": "2024-06-01T12:00:00"}, {"id": 4, "amount": 7000, "account_id": "C789", "timestamp": "2024-06-01T13:00:00"}, {"id": 5, "amount": 300, "account_id": "Y888", "timestamp": "2024-06-01T14:00:00"}, ] blacklist = ["X999", "Y888"] threshold = 10000 flagged = screen_transactions(transactions, blacklist, threshold) print(flagged)
copy

To build your screening function, structure your logic so that you loop through each transaction, check if it violates the amount threshold or appears in the blacklist, and collect any flagged transactions with the appropriate reason. For each violation, append a new dictionary with the transaction id and the reason for flagging to your results list. This modular approach makes it easy to extend screening logic as compliance requirements evolve.

Aufgabe

Swipe to start coding

Implement a function that screens transactions for compliance violations based on two rules: exceeding an amount threshold and involvement of a blacklisted account.

  • For each transaction, check if the 'amount' is greater than the threshold.
  • For each transaction, check if the 'account_id' is in the blacklist.
  • For each rule violated, add a dictionary to the result list containing the transaction 'id' and the reason ('amount' or 'blacklist').
  • Return the complete list of flagged transactions.

Lösung

Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 1. Kapitel 5
single

single

Fragen Sie AI

expand

Fragen Sie AI

ChatGPT

Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen

some-alt