It did let me pass with this code… however, I am aware my code does not clock the potential affordability of drone over ground… how might i have done that? … without functions… i realize that’s coming, and doable much easier with them, but… from here… with the assumed skill set… how would i make this code able to…
“facilitate”(?)
… with more …
“precision”(?)
weight = 119
price_per_pound = 0
price_flat = 20.00
premium_ground = 125.00
total_cost = 0
price_shipping = 0
method = "ground"
# Ground Shipping
print("Ground Shipping Premium $", premium_ground)
# LBS 0 - 2
if (method == "ground") or (method == "premium ground") and (weight > 0) and (weight >= 2):
price_per_pound = 1.50
if method == "ground":
price_shipping = price_per_pound * weight
total_cost = price_shipping + price_flat
if total_cost < premium_ground:
print(total_cost)
else:
print("Optimal Option: Premium Ground" , premium_ground)
elif method == "premium ground":
total_cost = premium_ground
print(total_cost)
# LBS 2 - 6
elif (method == "ground") or (method == "premium ground") and(weight > 2) and (weight >= 6):
price_per_pound = 3
if method == "ground":
price_shipping = price_per_pound * weight
total_cost = price_shipping + price_flat
if total_cost < premium_ground:
print(total_cost)
else:
print("Optimal Option: Premium Ground", premium_ground)
elif method == "premium ground":
total_cost = price_shipping + premium_ground
print(total_cost)
# LBS 6 - 10
elif (method == "ground") or (method == "premium ground") and (weight > 6) and (weight >= 10):
price_per_pound = 4
if method == "ground":
price_shipping = weight * price_per_pound
total_cost = price_shipping + price_flat
if total_cost < premium_ground:
print(total_cost)
else:
print("Optimal Option: Premium Ground", premium_ground)
elif method == "premium ground":
total_cost = premium_ground
print(total_cost)
# LBS 10+
elif (method == "ground") or (method == "premium ground") and (weight > 10):
price_per_pound += 4.75
if method == "ground":
price_shipping = weight * price_per_pound
total_cost = price_shipping + price_flat
if total_cost < premium_ground:
print(total_cost)
else:
print("Optimal Option: Premium Ground", premium_ground)
elif method == "premium ground":
total_cost = premium_ground
print(total_cost)
#Drone Shipping
if (method == "drone") and (weight > 0) and (weight >= 2):
price_per_pound = 4.50
price_shipping = price_per_pound * weight
print(price_shipping)
elif(method == "drone") and (weight > 2) and (weight >= 6):
price_per_pound = 9
price_shipping = price_per_pound * weight
print(price_shipping)
elif(method == "drone") and (weight > 6) and (weight >= 10):
price_per_pound = 12
price_shipping = price_per_pound * weight
print(price_shipping)
elif(method == "drone") and (weight > 10):
price_per_pound += 14.25
price_shipping = price_per_pound * weight
print(price_shipping)