Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In this lab, you use what you have learned about parallel lists to complete a partially completed Python program. The program is described in Chapter
In this lab, you use what you have learned about parallel lists to complete a partially completed Python program. The program is described in Chapter Exercise The program should either print the name and price for a coffee addin from the Jumpin Jive coffee shop or it should print the message Sorry, we do not carry that. Read the problem description carefully before you begin. The program provided for this lab includes the necessary variable initializations and input statements. You need to write the part of the program that searches for the name of the coffee addins and either prints the name and price of the addin or prints the error message, if the addin is not found.
Im using Python to write this program. When I run it it prints XXX price is "instead of cream price is Also the total is not being tallied up It just prints "Your order total is
# JumpinJive.py This program looks up and prints the names and prices of coffee orders.
# Input: Interactive.
# Output: Name and price of coffee orders or error message if addin is not found.
# Initialize variables.
NUMITEMS
# Initialized list of addins.
addIns Cream "Cinnamon", "Chocolate", "Amaretto", "Whiskey"
# Initialized list of addin prices.
addInPrices
orderTotal # All orders start with a charge
foundAdd False
# Get user input.
whileTrue:
addIns inputEnter coffee addin or XXX to quit:
ifaddIns XXX:
break
# Write the rest of the program here.
for i in rangeNUMITEMS:
ifaddInPricesi addInsi:
orderTotal orderTotal addInPricesi
printaddIns"price isaddInPricesi
foundAdd True
break
iffoundAdd False:
printSorry we do not carry that."
else:
printYour order total isorderTotal
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started