Question: Help me fix the following errors on my code: Line 1 1 : Incompatible types in assignment ( expression has type float, variable has type

Help me fix the following errors on my code:
Line 11 : Incompatible types in assignment (expression has type "float", variable has type "int")[assignment]
Line 18 : Unsupported operand types for +("str" and "int")[operator]
Line 33 : Incompatible types in assignment (expression has type "float", variable has type "int")[assignment]
Line 35 : Incompatible types in assignment (expression has type "float", variable has type "int")[assignment]
Line 37 : Incompatible types in assignment (expression has type "float", variable has type "int")[assignment]
Line 39 : Incompatible types in assignment (expression has type "float", variable has type "int")[assignment]
Line 46 : Unsupported operand types for +("int" and "str")[operator]
def toFixed(value, digits):
return "%.*f"%(digits, value)
subTotal =0
tAXRATE =0.06
var_continue = True
print("Enter prices:\t\t\t\t\t\t\t\t\t\t\t\t or -1 for subtotal \t\t\t\t\t\t\t\t\t\t\t or 0 for total:")
inPrice =float(input())
while inPrice !=0:
while inPrice >0:
subTotal = subTotal + inPrice
inPrice = float(input())
while inPrice <0:
print("---------")
print("Subtotal:$"+ toFixed(subTotal,2))
print("Enter prices:\t\t\t\t\t\t\t\t\t\t\t\t or -1 for subtotal \t\t\t\t\t\t\t\t\t\t\t\t or 0 for total:")
inPrice = float(input())
print("Total:"+ subTotal)
print("Coupon Menu:")
print("0:No Discount")
print("1:5% Discount")
print("2:10% Discount")
print("3: 15% Discount")
print("4: 20% Discount")
print("Coupon choice:")
menuOption = input()
while menuOption !="0" and menuOption !="1" and menuOption !="2" and menuOption !="3" and menuOption !="4":
print("Invalid. Enter Coupon menu option:")
menuOption = input()
if menuOption =="0":
discountPercent =0
if menuOption =="1":
discountPercent =0.05
if menuOption =="2":
discountPercent =0.1
if menuOption =="3":
discountPercent =0.15
if menuOption =="4":
discountPercent =0.2
discountAmount = subTotal * discountPercent
discountedSubTotal = subTotal - discountAmount
if menuOption =="0":
print("Sales Tax:$"+ toFixed(subTotal * tAXRATE,2))
print("Final Total:" + toFixed(subTotal + subTotal * tAXRATE,2))
else:
print(discountPercent *100+"%"+ "Discount:$"+ toFixed(discountAmount,2))
print("Subtotal After Disc:$"+ toFixed(discountedSubTotal,2))
print("Sales Tax: $"+ toFixed(discountedSubTotal * tAXRATE,2))
print("----------")
print("Final Total:$"+ toFixed(discountedSubTotal + discountedSubTotal * tAXRATE,2))
should look something like:
Enter prices:
or -1 for subtotal
or 0 for total:
$1.23
$5
$89.15
$-1
-------------
Subtotal:$95.38
Enter prices:
or -1 for subtotal
or 0 for total:
$.90
$-1
-----
Subtotal: $96.28
Enter prices:
or -1 fpr subtotal
or 0 for total:
$0
$96.28
Coupon Menu:
0: No Discount
1: 5% Discount
2: 10% Discount
3:15% Discount
4: 20% Discount
Coupon choice: 5
Invalid. enter coupon menu option:
1
5% Discount: $4.81
Subtotal after discount:$91.47
Sales Tax: $5.49
---------
Final Total: $96.95

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!