Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created December 25, 2020 11:03
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/083f5478286e99d33fde9021cfecd1a3 to your computer and use it in GitHub Desktop.
Save codecademydev/083f5478286e99d33fde9021cfecd1a3 to your computer and use it in GitHub Desktop.
Codecademy export
#4rd try
premium = 125.00
def ground_ship(weight):
if weight <= 2:
price = 1.5
elif 2 < weight <= 6:
price = 3
elif 6 < weight <= 10:
price = 4
else:
price = 4.75
return (20 + (price * weight))
def drone_ship(weight):
if weight <=2:
price = 4.5
elif 2 < weight <= 6:
price = 9
elif 6 < weight <= 10:
price = 12
else:
price = 14.25
return (price * weight)
def best_price(weight):
ground = ground_ship(weight)
drone = drone_ship(weight)
premium = 125
if ground < drone and ground < premium:
print("ground is cheap " + str(ground))
elif drone < ground and drone < premium:
print("drone is cheap " + str(drone))
else:
return print("you need premium")
best_price(2)
best_price(10)
best_price(50)
best_price(100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment