Python Clean Code Tip:
sumto sum the values of all elements inside an iterable instead of a
- Don't re-invent the wheel!
sumis much faster
transactions = [10.0, -5.21, 101.32, 1.11, -0.38] # without sum balance = 0 for transaction in transactions: balance += transaction # with sum balance = sum(transactions)