Challenge 2: filter, map, and reduce Chained — Solution fun main() { val prices = listOf(12.50, 8.00, 25.00, 3.50, 40.00) val total = prices .filter { it > 10.0 } .map { it * 0.8 } .reduce { acc, price -> acc + price } println(total) } /* Output: 62.0 Notes: - filter { it > 10.0 } keeps 12.50, 25.00, and 40.00 (drops 8.00 and 3.50). - map { it * 0.8 } applies a 20% discount to each remaining price: 10.0, 20.0, 32.0. - reduce { acc, price -> acc + price } sums those three discounted prices into a single total: 10.0 + 20.0 + 32.0 = 62.0. - The three operators are chained directly, so the output of filter feeds into map, and the output of map feeds into reduce, with no intermediate variables needed. */