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 Partial

I have no idea how to follow the same pattern. I am not coming up with a passable solution.

I get passed the first portion no sweat.

discount_10 = partial(discount, amount=10)

PASS

Then follow that same pattern to come up with 25% and 50%.

Perhaps I'm being too literal with what is being requested, as a result I have no idea where I'm going wrong. Unfortunately because the equation requires both answers be solved simultaneously I can't tell if I'm working towards the right direction. If anyone could shed some guidance it would be much appreciated. I've attempted too many possibilities and multiple approaches to be able to jot them down. I know the answer is going to be something ridiculously simple but I just can't seem to see it.

discounts.py
from functools import partial

prices = [
    10.50,
    9.99,
    0.25,
    1.50,
    8.79,
    101.25,
    8.00
]


def discount(price, amount):
    return price - price * (amount/100)

discount_10 = partial(discount, amount=10)

discount_25 = 

1 Answer

Hi Mario,

When you wrote discount_25 did you also change the amount keyword to 25 as well.

For 25 and 50 you're going to do the exact same thing as for 10 but change the numbers.

All 3 lines have to be there, 1 after the other.

Here's how the 25% discount would look:

discount_25 = partial(discount, amount=25)