# Define a function apply_discount(price, percent) that returns price minus (price * percent / 100)

Canonical URL: <https://datadriven.io/problems/define-a-function-applydiscountprice-percent-that-return-8b95b396>

Domain: Python · Difficulty: medium

## Problem

Define a function apply_discount(price, percent) that returns price minus (price * percent / 100). Also define a function format_price(p) that returns a string '$' followed by the value of p. Call apply_discount(100, 25) and store the result, then print format_price of that result.

## Related

- [All practice problems](https://datadriven.io/problems)
- [Mock interview mode](https://datadriven.io/interview/define-a-function-applydiscountprice-percent-that-return-8b95b396)
- [Python Interview Questions](https://datadriven.io/python-interview-questions)
- [Data Engineering Interview Prep Guide](https://datadriven.io/data-engineer-interview-prep)
- [Daily Challenge](https://datadriven.io/daily)

---

Source: DataDriven (https://datadriven.io). 100% free data engineering interview prep. Live code execution against Postgres 16, Python 3.11, and Spark sandboxes. No paywall, no premium tier, no signup gate.