Project Sal's shipping type errors

def ground_ship(weight):
if weight > 10:
heavy = weight * 4.75 + 20.00
return print("Your price is " + str(heavy) + “.") elif weight >= 6: medium_heavy = weight * 4.00 + 20.00 return print("Your price is " + str(medium_heavy) + "0.”)
elif weight > 2:
light_medium = weight * 3.00 + 20.00
return print("Your price is " + str(light_medium) + “0$.”)
elif weight <= 2:
light = weight * 1.50 + 20.00
return print("Your price is " + str(light) + “0$.”)

premium_ground_shipping = “125.00$”

def drone_ship(weight):
if weight > 10:
heavy = weight * 14.25
return print("Your price is " + str(heavy) + “.") elif weight >= 6: medium_heavy = weight * 12.00 return print("Your price is " + str(medium_heavy) + "0.”)
elif weight > 2:
light_medium = weight * 9.00
return print("Your price is " + str(light_medium) + “0$.”)
elif weight <= 2:
light = weight * 4.50
return print("Your price is " + str(light) + “0$.”)

def price_check(weight):
drone = drone_ship
ground = ground_ship
premium = premium_ground_shipping
if drone < ground and drone < premium:
return “Drone delivery is your best option” + str(drone_ship)
elif ground < drone and ground < premium:
return “Ground delivery is your best option” + str(ground_ship)
elif premium < ground and premium < drone:
return “Premium delivery is your best option” + str(premium_ground_shipping)

print(price_check(4.8))

1 Like

Cant seem on how to fix those as after doing some rewrites and couldnt figure out a solution even with the videos help. my goal is not to copy the video exactly since it feels like cheating but my skills are very limited since im still quite new so any nudges in the right direction would be great.

Formatting your code using the </> button makes it more readable for anyone trying to help out. Please do so. Posting the error you got would also help to identify what the problem is.

Since you mentioned you got a TypeError, it likely has something to do with using an invalid function on a certain data type. You can find more on that here.

Welcome to the forums!

4 Likes

So in the future if i have a problem you want to isolate them in the <> as in like <Line 4 return ground_delivery> and thank you for the link !

Sorry, the part about </> may have been a bit confusing. This should clarify things.

Code Blocks

Toolbar Icon
Using Preformatted Text icon on the toolbar

This will automatically create a code block which you can paste your code in.
capture_r
Or select your code and then press the icon.


No problem! Is your problem solved then? Or if you still need help, feel free to ask any other questions!

3 Likes