Can someone explain the following loop code converted into a one line code?
Code:
total_price = 0
for cost in gift_costs:
    if cost < 25:
        total_price += cost * 1.08
Converted one line code:
total_price = (gift_costs[gift_costs < 25]).sum() * 1.08
 
     
     
     
    