Answer:
Here is the Python program:
taco=1.30
burrito=2.50
nachos=3.35
SALES_TAX=0.0875
subtotal = taco+nachos+burrito
tax=subtotal*SALES_TAX
total = subtotal+tax
print(f"Taco:\t\t${taco}\\Burrito:\t${burrito}\\Nachos:\t\t${nachos}\\SubTotal:\t${subtotal}\\")
print(f'Tax:\t\t${tax:.2f}\\Total:\t\t${total:.2f}')
Step-by-step explanation:
First the variable taco is assigned 1.30 value
Then variable burrito is assigned 2.50 value
Then variable nachos is assigned 3.35 value
Next value of constant variable SALES_TAX is set to 0.0875
Next subtotal of an order is calculated by adding the values of taco, burrito and nachos.
Next tax of the order is computed by multiplying the values of subtotal and SALES_TAX .
Next total of that order including tax is calculated by adding the value of tax to that of subtotal
The last two print statements use f-string formatting to print the output. In the first print statement
print(f"Taco:\t\t${taco}\\Burrito:\t${burrito}\\Nachos:\t\t${nachos}\\SubTotal:\t${subtotal}\\")
\t is used to give tab space
f is used as a start of f-string
\\ is used to add a new line
$ sign is attached to the values of taco, burrito, nachos and subtotal.
The second print statement:
print(f'Tax:\t\t${tax:.2f}\\Total:\t\t${total:.2f}')
{tax:.2f} and {total:.2f} means the values of tax and total variables are displayed up to two decimal place (.2f)
So the output of the above program is:
Taco: $1.3
Burrito: $2.5
Nachos: $3.35
SubTotal: $7.15
Tax: $0.63
Total: $7.78
However this can be written in one statement only
print(f"Taco:\t\t${taco}\\Burrito:\t${burrito}\\Nachos:\t\t${nachos}\\SubTotal:\t${subtotal}\\\\Tax:\t\t${tax:.2f}\\Total:\t\t${total:.2f}")
This single statement will print the above given output.