# Writing small, focused functions def calculate_subtotal(item_prices): return sum(item_prices) def calculate_tax(subtotal, tax_rate): return subtotal * tax_rate def calculate_total_cost(item_prices, tax_rate): subtotal = calculate_subtotal(item_prices) tax = calculate_tax(subtotal, tax_rate) total_cost = subtotal + tax return total_cost