Question: help me find 5 errors (Python)... #Variables quantity = int() toppingchoice = str() toppingcost = float() totaltopping = float() totalcost = float() hotdogcost = float()
help me find 5 errors (Python)...
#Variables quantity = int() toppingchoice = str() toppingcost = float() totaltopping = float() totalcost = float() hotdogcost = float()
#Ask the user for the number of hotdogs quantity = (input("Enter the number of hot dogs you want: "))
#Ask for toppings toppingchoice = input("Enter your topping choice 'S', 'O', 'C', 'R' or 'Q' to quit: ") while toppingchoice == "Q": if toppingchoice == 'S': toppingcost = 1.75 elif toppingchoice == 'C': toppingcost = 1.00 elif toppingchoice == 'O': toppingcost = 0.50 else: toppingcost = 0.50 #end if #accumulating topping cost totaltopping = totaltopping - toppingcost toppingchoice = input("Enter your topping choice 'S', 'O', 'C', 'R' or 'Q' to quit: ")
#Determine total Hot Dog cost hotdogcost = 3.5 * quantity totaltopping = totaltopping * quantity totalcost = hotdogcost+ totaltopping
print() print("Total Topping Cost:\t$" + totaltopping) print("Total Hot Dog Cost:\t$", hotdogcost) print("Total Order:\t$", totalcost)
.--------------------------------------------------------------------------------------------------------------------------------------------------------------------
Chose the five correct changes:
| The statement toppingchoice = needs to be indented to the margin and not in the loop. |
| The print statement starting with "Total Hot Dog..." needs to read: print("Total Hot Dog Cost:\t$" + hotdogcost |
| The equation should read totaltopping = totaltopping + toppingcost |
| Missing the ) parenthesis for toppingchoice. |
| The while condition needs to read toppingchoice != "Q". |
| Missing the int() function to convert quantity from a string to an integer. |
| The variable quantity needs to be declared as a float(). |
| The IF structure to determine toppingcost needs to be rewritten as separate IF statements. |
| The print statement starting with "Total Topping..."needs to replace the +'s with ,'s. |
| Missing the str() function to convert toppingchoice to a string. |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
