Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created June 23, 2020 11:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/c1e9ee2c00d52e3f4184386ceef55346 to your computer and use it in GitHub Desktop.
Save codecademydev/c1e9ee2c00d52e3f4184386ceef55346 to your computer and use it in GitHub Desktop.
Codecademy export
def ground_shipping(weight):
if (weight <= 2.0):
cost = (weight * 1.50) + 20.00
elif (weight <= 6.0):
cost = (weight * 3.00) + 20.00
elif (weight <= 10.0):
cost = (weight * 4.00) + 20.00
else:
cost = (weight * 4.75) + 20.00
return "Thank you for choosing Sal's Shippers. Your ground shipping price is $" + cost + ". Thank you."
def p_ground_shipping():
return "Thank you for choosing Sal's Shippers. You have chosen Premium Ground Shipping. Your total charge is $125.00"
def drone_shipping(weight):
if (weight <= 2.0):
cost = (weight * 4.5)
elif (weight <= 6.0):
cost = (weight * 9.0)
elif (weight * 10.0):
cost = (weight *12.0)
else:
cost = (weight * 14.25)
return "Thank you for choosing Sal's Shippers. Your drone shipping price is $" + str(cost) + ". Thank you."
def advise(weight):
if (ground_shipping(cost) < drone_shipping(cost)):
return "Thank you for choosing Sal's Shippers. With your current package weight, your cheapest option would be Standard Ground Shipping. Your shipping cost with Standard Ground Shipping is: $" + ground_shipping(cost) + ". Thank you."
if (drone_shipping(cost) < ground_shipping(cost)):
return "Thank you for choosing Sal's Shippers. With your current package weight, your cheapest option would be Drone Shipping. Your shipping cost with Drone Shipping is: $" + drone_shipping(cost) + ". Thank you."
if (125.00 < ground_shipping(cost)) and (125.00 < drone_shipping(cost)):
return "Thank you for choosing Sal's Shippers. With your current package weight, your cheapest option would be Premium Ground Shipping. Your shipping cost with Premium Ground Shipping is $125.00. Thank you."
print(advise(4.8))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment