Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Working with Transaction Data | Automating Compliance Checks
Practice
Projects
Quizzes & Challenges
Quizze
Challenges
/
Python for Compliance Officers

bookWorking with Transaction Data

Swipe um das Menü anzuzeigen

When working with transaction data for compliance purposes, you need to organize and manipulate information efficiently. In Python, the most useful data structures for this are lists and dictionaries. A list allows you to store a collection of items in order, while a dictionary lets you store data as key-value pairs. For transaction data, you often use a list where each item is a dictionary representing a single transaction. Each dictionary can store details such as the transaction's id, amount, type, and status, making it easy to access and update specific pieces of information as needed for compliance checks.

12345678910
# Create a list of dictionaries, each representing a transaction transactions = [ {"id": "TX1001", "amount": 2500.0, "type": "deposit", "status": "pending"}, {"id": "TX1002", "amount": 500.0, "type": "withdrawal", "status": "approved"}, {"id": "TX1003", "amount": 12000.0, "type": "deposit", "status": "pending"} ] # Print the transactions list for transaction in transactions: print(transaction)
copy

To work with transaction data, you often need to access or update specific information. You can do this by referencing the dictionary keys. For example, to get the amount of the first transaction, use transactions[0]["amount"]. To update the status of a transaction after a compliance check, assign a new value to the "status" key. This approach allows you to efficiently process and modify transaction records as part of your compliance workflow.

12345678
# Update the status of a transaction after a compliance check for transaction in transactions: if transaction["id"] == "TX1001": transaction["status"] = "approved" # Print updated transactions for transaction in transactions: print(transaction)
copy

1. What Python data structure allows you to store key-value pairs for each transaction?

2. How can you update the status of a transaction in a list of dictionaries?

3. Why is it useful to use dictionaries for transaction data?

question mark

What Python data structure allows you to store key-value pairs for each transaction?

Select the correct answer

question mark

How can you update the status of a transaction in a list of dictionaries?

Select the correct answer

question mark

Why is it useful to use dictionaries for transaction data?

Select the correct answer

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 1. Kapitel 2

Fragen Sie AI

expand

Fragen Sie AI

ChatGPT

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

Abschnitt 1. Kapitel 2
some-alt