# in python2.2Write a program that prompts the user for two inputs: the unit cost of an item and the quantity of the item. The program should then output the subtotal for the item in currency format with two decimals and the \$ sign right up against the first digit. This will require the sep argument. See page 66 and the Sample Output. NOTE: User inputs are shown in blue.Sample OutputEnter the unit price 2.49Enter the quantity 8Please pay \$19.92

Question
49 views

in python

2.2Write a program that prompts the user for two inputs: the unit cost of an item and the quantity of the item. The program should then output the subtotal for the item in currency format with two decimals and the \$ sign right up against the first digit. This will require the sep argument. See page 66 and the Sample Output. NOTE: User inputs are shown in blue.
Sample Output
Enter the unit price 2.49
Enter the quantity 8

check_circle

Step 1

round() function is used to round the number.

Syntax of round function:

round(number [, ndigit])

number is first argument of round of where number that is to rounded.

ndigit is second argument used for number of precision point.

sep argument is used to separate two values on the basis of “ ”, “_”, “-” etc.

Step 2

Program code:

unitcost=float(input("Enter the unit price: "))

quantity=int(input("Enter the quantity: "))...

### Want to see the full answer?

See Solution

#### Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in