Kodewick
Start learning →
Basic←→0 / 100

Three or more, 10% off

#095BasicMixedLists4 min

The stationery shop has a deal: buy 3 or more things at once and the total is 10% off. Write checkout(prices) to return what to pay, rounded to one decimal place with round. Under 3 things, pay full price (still rounded to one place).

Examples
checkout([10, 20, 30])→54.0
checkout([15, 5])→20
checkout([2.5, 4, 3.5, 10])→18.0
main.py
def checkout(prices):
    total = sum(prices)
    # your code here: 3 or more things, total times 0.9

    return round(total, 1)
Ctrl + Enter runs too
Result

Run tries the examples. When they look right, Submit.