Kodewick
Start learning →
Basic←→0 / 100

Price after the sale

#086BasicNumbers3 min

The bookshop takes percent_off% off a book that costs price. Write sale_price(price, percent_off) to return the new price, rounded to 1 decimal place. A percent_off of 0 means the full price.

Examples
sale_price(80, 25)→60.0
sale_price(19.9, 10)→17.9
main.py
def sale_price(price, percent_off):
    # your code here: work out the money off
    off = 0
    return round(price - off, 1)
Ctrl + Enter runs too
Result

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