Print the Price Tag

Python for AIEasy+10 XP+10

Print the Price Tag

A shop shows prices like $1,234.50: a dollar sign, commas between the thousands, and exactly two decimal places.

Task: write price_tag(amount) that returns amount written that way.

  • amount is never negative.
  • Round to 2 decimal places the way an f-string format spec does.

Examples

amount = 1234.5
returns '$1,234.50'
amount = 0
returns '$0.00'

Hints

Solve it to unlock the solution

Once your code passes every test, a reference solution shows up here so you can compare it with yours.

solution.py
CtrlEnterto run