In: Computer Science
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 :
")
#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.