Question
I need the Python code that answers the assignment question below. The code that I came up with is what is shown. The first 5
I need the Python code that answers the assignment question below. The code that I came up with is what is shown. The first 5 variables are given, and will vary when the code is tested upon submission. Please give me the correct code and tell me why my code is wrong. Thank you!
item = "quesadilla"
meat = "steak"
queso = False
guacamole = False
double_meat = False
#-----------------------------------------------------------
#You may modify the lines of code above, but don't move them!
#When you Submit your code, we'll change these lines to
#assign different values to the variables.
#
#Let's further expand our previous program to cover a broader
#menu variety. Instead of just burritoes, now the program
#should cover three menu items: quesadillas, burritoes, and
#nachos. Instead of separate booleans for steak and pork,
#we instead have a string that could be "steak", "pork",
#"chicken", "tofu", and "beef". We still have booleans for
#queso and guacamole, but we also have a boolean for double
#meat.
#
#Your code should calculate the price as follows:
#
# - The base price for a quesadilla is 4.00, for nachos is
#4.50, and for burritoes is 5.00.
# - If meat is steak or pork, add 0.50. Any other meat adds
#no money to the price.
# - guacamole always adds 1.00 to the price.
# - queso adds 1.00 to the price UNLESS the item is nachos,
#in which case it adds nothing.
# - double_meat adds 1.50 if the meat is steak or pork, or
#1.00 otherwise.
base_price = 4.0
if item == "nachos":
base_price += .5
if item == "burrito":
base_price += 1.0
if meat == "steak" or "pork":
base_price += 0.50
elif meat == "steak" and double_meat:
base_price += 1.50
elif meat == "pork" and double_meat:
base_price += 1.50
elif meat == ("chicken" or "tofu" or "beef") and double_meat:
base_price += 1.0
if guacamole:
base_price += 1.0
if queso and not "nachos":
base_price += 1.0
print(base_price)
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