Question

In: Computer Science

Hello everyone! I have been stuck on this problem in my python 3 coding class. Is...

Hello everyone! I have been stuck on this problem in my python 3 coding class. Is there anybody who can see what I am doing wrong? The wings are .50 cents each, If I input sour and want 20 wings it should output a 0.15 discount. I just can't get it to work but I feel like I am really close. Thank you

Code:

#Variables
answer = str()
wings = int()
rate = float()
discount = float()
subtotal = float()
total = float()

#Enter the type of wings
type = input("Enter the wing type: ")
sour = int()
hot = int()

#determining the discount rate
while answer != 'no':
#Enter the quantity of wings
wings = int(input("Enter the quantity: "))
if hot <= 6:
rate = 0
elif hot > 6 <= 12:
rate = 0.1
elif hot > 12 <= 24:
rate = 0.2
elif sour <= 6:
rate = 0.05
elif sour > 6 <= 12:
rate = 0.1
elif sour > 12 <= 24:
rate = 0.15
else: 0.25

#determining the subtotal
subtotal = wings * .5
#determining the discount
discount = rate * subtotal
#determining the total
total = subtotal - discount

#print out rate, subtotal, discount and total
print("Discount Rate:", rate)
print("Subtotal: $", subtotal)
print("Discount: $", discount)
print("Total: $", total)
#ask the user if they want to enter another batch
answer = input("Would like to purchase another order of wings : ")

Solutions

Expert Solution

#Variables
answer = str()
wings = int()
rate = float()
discount = float()
subtotal = float()
total = float()

#Enter the type of wings
wing_type = input("Enter the wing type: ")

#determining the discount rate
while answer != 'no':

   #Enter the quantity of wings
   wings = int(input("Enter the quantity: "))

   if wing_type == 'hot':
      if wings <= 6:
         rate = 0
      elif wings > 6 and wings <= 12:
         rate = 0.1
      elif wings > 12 and wings <= 24:
         rate = 0.2
      else:
         rate = 0.25

   elif wing_type == 'sour':
      if wings <= 6:
         rate = 0.05
      elif wings > 6 and wings <= 12:
         rate = 0.1
      elif wings > 12 and wings <= 24:
         rate = 0.15
      else:
         rate = 0.25

   #determining the subtotal
   subtotal = wings * 0.5

   #determining the discount
   discount = rate * subtotal

   #determining the total
   total = subtotal - discount

   #print out rate, subtotal, discount and total
   print("Discount Rate:", rate)
   print("Subtotal: $", subtotal)
   print("Discount: $", discount)
   print("Total: $", total)

   #ask the user if they want to enter another batch
   answer = input("Would like to purchase another order of wings : ")

FOR HELP PLEASE COMMENT.
THANK YOU.


Related Solutions

This is a question for my problem-solving class. I am really stuck and I can't see...
This is a question for my problem-solving class. I am really stuck and I can't see much of a pattern so I would appreciate if someone could draw out for each thief and explain the pattern to get the answer for 40 thieves! Question: Forty thieves, all different ages, steal a huge pile of identical gold coins and must decide how to divide them up. They settle on the following procedure. The youngest divides the coins among the thieves however...
/* I been trying to solve this problem . this is my own coding /here is...
/* I been trying to solve this problem . this is my own coding /here is the HW INSTRUCTION Let the user to try of maximum 8 times to find the random number For every try display if the user find or not the number and the number of tries At the end of each game display to the user the number of tries to find the number Allow the user to play a maximum of 4 times, by asking...
Hello! I'm trying to work on a python lab in my class, and we basically have...
Hello! I'm trying to work on a python lab in my class, and we basically have to make this method play_interactive Now for the fun bit. The function play_interactive will take just one argument --- the length of patterns to use as keys in the dictionary --- and will start an interactive game session, reading either '1' or '2' from the player as guesses, using the functions you wrote above and producing output as shown in the sample game session...
Hello this is for C++ language. I am currently stuck on creating my api for Day...
Hello this is for C++ language. I am currently stuck on creating my api for Day Trading Stocks. as follows I need an api for *//Function Signature * * parameter: * * Return Value: ** *// Write the following function taking in an integer vector (vector &prices) consisting of all prices, in chronological order, for an hypothetical instrument. Your function recommends the maximum profit an investor can make by placing AT MOST one buy and one sell order in the...
In Python I have a code: here's my problem, and below it is my code. Below...
In Python I have a code: here's my problem, and below it is my code. Below that is the error I received. Please assist. Complete the swapCaps() function to change all lowercase letters in string to uppercase letters and all uppercase letters to lowercase letters. Anything else remains the same. Examples: swapCaps( 'Hope you are all enjoying October' ) returns 'hOPE YOU ARE ALL ENJOYING oCTOBER' swapCaps( 'i hope my caps lock does not get stuck on' ) returns 'I...
Python Coding Question (Data Science) Hello I am having difficulty writing a code in python to...
Python Coding Question (Data Science) Hello I am having difficulty writing a code in python to do a specific task. I have two text files, Positive.txt and Practice_forhw1.txt. I want to write a script that will check if any words in Practice_forhw1.txt match any of the words in Positive.txt then the word would get replaced with a "+1" in the Practice_forhw1.txt and then print out the Practice_forhw1.txt.  (i.e if the word "happy" is in both Positive.txt and Practice_forhw1.txt then I want...
hello everyone, i have this assignment to do and i dunno how to structure it as...
hello everyone, i have this assignment to do and i dunno how to structure it as i didnt have enough informations about the layout and the structure. please provide me with the structure starting from the introduction, excutive summary,...,.....,......,.......,conclusion and references. i need to fill up the paragraphs but i dunno what to layout. Assume your group comprises the Sydney City Council. In an effort to reduce inner city congestion, there is already a project to establish light rail. But...
I am stuck on the following problem please and it has to be in python! 1)...
I am stuck on the following problem please and it has to be in python! 1) Initially, create a list of the following elements and assign the list to a variable "thing". "Mercy", "NYU", "SUNY", "CUNY" 2) print the list above 3) add your last name to the list 4) print the list 5) add the following elements as a nested list to the list: "iPhone", "Android" 6) print the list 7) add the following list to the end of...
This is for my finance class and I am a bit stuck. We're asked to use...
This is for my finance class and I am a bit stuck. We're asked to use the Delta hedging formula (i.e. how much stock to hold) for the multiperiod binomial model to confirm that a financial derivative paying the stock price at time t=N (i.e. V_N = S_N) must be priced with V_0 = S_0 today.
I have a quick question about this C ++ problem in my intro class. I have...
I have a quick question about this C ++ problem in my intro class. I have been able to get the first answer consistently when I test it, but my second seems to either be high or low no matter how I change it. Can you show me how you would do this problem with the setprecision(2) Paula and Danny want to plant evergreen trees along the back side of their yard. They do not want to have an excessive...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT