You are on page 1of 2

#Let's create an example of a list representing bank account transactions.

Each
transaction can include details such as the date, description, amount, and
transaction type. Here's a sample list with fictional data:

# In this example:

# Each transaction is represented as a dictionary with keys like "date,"


"description," "amount," and "transaction_type."
# The bank_transactions list contains multiple transactions.
# Positive amounts represent deposits, and negative amounts represent withdrawals.
# The loop at the end prints out the details of each transaction.

# A list can store the history of your bank account transactions, including the
date, amount, description, and category (debit or credit). This allows you to see
your transactions in chronological order and filter them by category for easier
budgeting and tracking.

bank_transactions = [
{"date": "2024-03-01", "description": "Salary Deposit", "amount": 5000.00,
"transaction_type": "Deposit"},
{"date": "2024-03-05", "description": "Grocery Store", "amount": -150.00,
"transaction_type": "Withdrawal"},
{"date": "2024-03-10", "description": "Utility Bill Payment", "amount": -80.00,
"transaction_type": "Withdrawal"},
{"date": "2024-03-15", "description": "Dinner with Friends", "amount": -40.00,
"transaction_type": "Withdrawal"},
{"date": "2024-03-20", "description": "Online Purchase", "amount": -120.00,
"transaction_type": "Withdrawal"},
{"date": "2024-03-25", "description": "Investment Dividends", "amount": 100.00,
"transaction_type": "Deposit"},
]

# Display the transactions


for transaction in bank_transactions:
print(f"Date: {transaction['date']}, Description: {transaction['description']},
Amount: {transaction['amount']}, Type: {transaction['transaction_type']}")

# List of Tuples

# You've provided a list of tuples representing bank account transactions. It seems


like each tuple includes the transaction date, amount, transaction type, and a
brief description. This format is still a valid and concise representation of bank
transactions. Here's the updated list:

# In this example, each tuple has four elements: date, amount, transaction type,
and description. The loop at the end prints out the details of each transaction
using unpacking to access individual elements of the tuple.

bank_transactions = [
("2024-03-08", 100.00, "Deposit", "Salary"),
("2024-03-06", -25.00, "Withdrawal", "Coffee"),
("2024-03-01", 50.00, "Deposit", "Allowance"),
("2024-02-29", -150.00, "Withdrawal", "Rent"),
]
# Display the transactions
for transaction in bank_transactions:
date, amount, transaction_type, description = transaction
print(f"Date: {date}, Amount: {amount}, Type: {transaction_type}, Description:
{description}")

You might also like