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! While you're at it, check out some resources Treehouse students have shared here.

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

Python Functional Python The Lambda Lambada Reduce

Jack Cummins
Jack Cummins
17,417 Points

Please help, I don't know what to do.

The task is: We need to add two numbers together. We could write a function that does this but that seems silly.
Import add from the operator module.

Please give the code and explain how the code works.

Thank You! Jack

prices.py
from operator import add


prices = [
    (6.99, 5),
    (2.94, 15),
    (156.99, 2),
    (99.99, 4),
    (1.82, 102)
]

def product_sales(x):
    return x[0] * x[1]

1 Answer

Steven Parker
Steven Parker
231,248 Points

It looks like you've already done it. The code shown here will pass task 2.

What kind of problem are you having?

Jack Cummins
Jack Cummins
17,417 Points

Oh, I thought that you would have to do more than just import to complete the task, and didn't know if I should do anything next. After you told me that though, I copyed and pasted my code back in and it passed.

Thanks So Much!!!!!!! Jack

Steven Parker
Steven Parker
231,248 Points

This one is simple, but it sets things up for task 3.