# Variables item, price, and qty are provided

Canonical URL: <https://datadriven.io/problems/variables-item-price-and-qty-are-provided-use-an-f-string-0419c3a2>

Domain: Python · Difficulty: medium

## Problem

Variables item, price, and qty are provided. Use an f-string to print a line in the format: "Widget: 4 x $9.50 = $38.00" where the dollar amounts are formatted to exactly 2 decimal places. Calculate the total as price * qty.

## Related

- [All practice problems](https://datadriven.io/problems)
- [Mock interview mode](https://datadriven.io/interview/variables-item-price-and-qty-are-provided-use-an-f-string-0419c3a2)
- [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.