Complete the code to calculate the total amount owed by a user.
total_owed = sum(expense.amount for expense in user.expenses if expense.paid_by != [1])
The total amount owed by a user is the sum of expenses not paid by the user, identified by user.id.
Complete the code to split an expense evenly among participants.
share = expense.amount / [1]The expense amount is divided evenly by the number of participants to find each person's share.
Fix the error in the code that calculates the balance for each user.
balance = user.paid_amount - sum(user.owed_amounts.get([1], 0) for user in users)
To get the owed amount for the specific user, use user.id as the key in owed_amounts dictionary.
Fill both blanks to create a dictionary of user balances where keys are user IDs and values are their net balances.
balances = {user.[1]: user.[2] for user in users}The dictionary keys should be user IDs and values should be their net balances.
Fill all three blanks to filter expenses where the amount is greater than zero and the payer is not the current user.
filtered_expenses = [expense for expense in expenses if expense.[1] > [2] and expense.[3] != current_user.id]
We filter expenses with amount greater than zero and exclude those paid by the current user.