File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 1212items_on_special = filter (lambda item : item .on_special , shopping_list )
1313
1414# Create a list of prices and use `reduce()` to add them up
15- prices_of_items_on_special = list (item .price for item in items_on_special )
16- specials_only_total = reduce (lambda x , y : x + y , prices_of_items_on_special )
15+ specials_prices = list (item .price for item in items_on_special )
16+ specials_total = reduce (lambda x , y : x + y , specials_prices )
1717
18- savings = total - specials_only_total
18+ savings = total - specials_total
1919
2020print (" -- but if you just bought things that were on special, it'd be " , end = "" )
21- print (f"${ specials_only_total :.2f} (saving you ${ savings :.2f} )." )
21+ print (f"${ specials_total :.2f} (saving you ${ savings :.2f} )." )
You can’t perform that action at this time.
0 commit comments