Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
i'm not sure why this is not working
it giving me an error saying couldn't find product_sales()
import add prices = [ (6.99, 5), (2.94, 15), (156.99, 2), (99.99, 4), (1.82, 102) ] def product_sales(single_two): price,units=single_two return price* units print(reduce(product_sales,prices))
Travis AlstrandData Analysis Techdegree Graduate 45,427 Points
Hey there tryston downing !
I think it may be a few things, but I'm not sure exactly what challenge step you're working on. But the reduce import need a little editing and we want to be returning a value instead of printing it. The following code got me up to the last challenge, this should help get you there as well. From there, read the instructions carefully, we'll be wanting to use
add and creating a new variable. I hope this helps you out
from operator import add from functools import reduce prices = [ (6.99, 5), (2.94, 15), (156.99, 2), (99.99, 4), (1.82, 102) ] def product_sales(a_tuple): price, units = a_tuple return price * units