Python Code Example
Here's how you'd handle expenses in Python:
expenses = []
expense = {
"amount": 25.50,
"category": "Food",
"description": "Lunch at cafe",
"date": "2026-02-24"
}
expenses.append(expense)
total = sum(e["amount"] for e in expenses)
print(f"Total: ${total:.2f}")
import json
with open("expenses.json", "w") as f:
json.dump(expenses, f, indent=2)
Try the Python terminal version for the full experience!