Write Python code for the following Pseudocode Step 1: define the constant value for tax as 6% Step 2: define the tip percentage for each meal price range Step 3: Take the input meal price from the user Step 4: if price in range(0.01, 5.99) : tip = price * (10/100) tax = price * (6/100) totalCost = price + tip + tax else if price in range(6, 12) : tip = price * (13/100) tax = price * (6/100) totalCost = price + tip + tax else if price in range(12.01, 17.00) : tip = price * (16/100) tax = price * (6/100) totalCost = price + tip + tax else if price in range(17.01, 25.00) : tip = price * (19/100) tax = price * (6/100) totalCost = price + tip + tax else: tip = price * (22/100) tax = price * (6/100) totalCost = price + tip + tax Step 5: Print the value of totalCost
Write Python code for the following Pseudocode
Step 1: define the constant value for tax as 6%
Step 2: define the tip percentage for each meal price range
Step 3: Take the input meal price from the user
Step 4:
if price in range(0.01, 5.99) :
tip = price * (10/100)
tax = price * (6/100)
totalCost = price + tip + tax
else if price in range(6, 12) :
tip = price * (13/100)
tax = price * (6/100)
totalCost = price + tip + tax
else if price in range(12.01, 17.00) :
tip = price * (16/100)
tax = price * (6/100)
totalCost = price + tip + tax
else if price in range(17.01, 25.00) :
tip = price * (19/100)
tax = price * (6/100)
totalCost = price + tip + tax
else:
tip = price * (22/100)
tax = price * (6/100)
totalCost = price + tip + tax
Step 5: Print the value of totalCost
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images