I tried playing around with a shortened version of the sal’s shipping project but keep getting an error and am unsure why. Would be curious to know where I went wrong. I was attempting to write a code that would only show the cheapest option.
The error is:
Traceback (most recent call last):**
File “My_attempts.py/Sal_Shipping_Short.py”, line 4, in **
Cost_of_shipping = Weight * Price_per_pound + Flat_Charge**
TypeError: unsupported operand type(s) for : ‘float’ and ‘type’*
Do you guys have any ideas on why I keep getting this error?
Here is my code:
Price_per_pound= float
Flat_Charge= float
Weight= 8.4
Cost_of_shipping = Weight * Price_per_pound + Flat_Charge
if Weight <= 2.00:
Price_per_pound= 1.50 or 4.50
Flat_Charge= 20.00 or 0.00
elif Weight <=6.00:
Price_per_pound= 3.00 or 9.00
Flate_Charge= 20.00 or 0.00
elif weight <= 10:
Price_per_pound= 4.00 or 12.00
Flate_Charge= 20.00 or 0.00
if Cost_of_shipping >= 125.00:
print(“Ground Shpping Premium is your cheapest shipping option”)
elif Cost_of_shipping >= 23.00:
print(“Drone Shipping is your cheapest shipping option”)
else:
print(“Ground Shipping is your cheapest option”)