Complete the code to calculate the fine amount based on days late.
fine = [1] * days_lateThe fine is calculated by multiplying the rate per day by the number of days late.
Complete the code to check if a fine should be applied based on days late.
if [1] > 0: apply_fine = True
We apply a fine only if the number of days late is greater than zero.
Fix the error in the code to correctly calculate the total fine with a maximum cap.
total_fine = min([1] * days_late, max_fine)
The fine is calculated by multiplying the rate per day by days late, then capped by max_fine.
Fill both blanks to create a dictionary comprehension that maps each user to their fine if late.
user_fines = {user: [1] * days for user, days in late_days.items() if days [2] 0}The fine is calculated by multiplying rate_per_day by days late, only for users with days late greater than zero.
Fill the blanks to filter users with fines above threshold and create a summary dictionary.
high_fines = {user: fine for user, fine in user_fines.items() if fine [1] threshold}
summary = {
'count': len(high_fines),
'max_fine': max(high_fines.values()) if high_fines else 0,
'average_fine': sum(high_fines.values()) [2] len(high_fines) if high_fines else 0
}The code filters fines greater than the threshold, counts them, finds the max fine, and calculates the average by dividing the sum by count.
