Professional Documents
Culture Documents
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:
# 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"},
]
# List of Tuples
# 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}")