143k views
4 votes
Create a flowchart that describes the following algorithm and then write Python code to implement the algorithm. Write the Python code in a Python program file, NOT in the IDLE window. Include in your HW PDF document a photo of your flowchart and a screenshot of your program code. Also include in your HW PDF a screenshot of the output that appears in the IDLE window.

1 Answer

2 votes

Answer:

Python code is as follows:

********************************************************************************

#function to get number up to any number of decimal places

def toFixed(value, digits):

return "%.*f" % (digits, value)

print("Enter the price: ", end='', flush=True) #prompt for the input of price

price = float(input()) #taken input

totalCost = price + 0.05 * price #calculating cost

print("Total Cost after the sales tax of 5% is applied: " + toFixed(totalCost,2)) #print and output totalCost

************************************************************************************

Create a flowchart that describes the following algorithm and then write Python code-example-1
Create a flowchart that describes the following algorithm and then write Python code-example-2
Create a flowchart that describes the following algorithm and then write Python code-example-3
Create a flowchart that describes the following algorithm and then write Python code-example-4
User Ishtiaque
by
3.2k points