Skip to content

Create my-shipping.py #141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions 2-control-flow/sals-shipping/my-shipping.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#@Pietmkn (Piet Mokoena)
weight = 50
#Ground shipping
if weight <=2 :
ground_shipping_cost = weight * 1.5 + 20
elif weight > 2 and weight <= 6:
ground_shipping_cost = weight * 3.00 + 20
elif weight > 6 and weight <=10:
ground_shipping_cost = weight * 4.00 + 20
else:
ground_shipping_cost = weight * 4.75 + 20
print("Ground Shipping Cost $", ground_shipping_cost)

premium_ground_shipping_cost = 125.00
print("Premium Ground Shipping Cost $", premium_ground_shipping_cost)

if weight <= 2:
drone_shipping_cost = weight * 1.5 * 3
elif weight > 2 and weight <=6:
drone_shipping_cost = weight * 3.00 * 3
elif weight > 6 and weight <= 10:
drone_shipping_cost = weight * 4.00 * 3
else:
drone_shipping_cost = weight * 4.75 * 3
print("Drone Shipping Cost $",drone_shipping_cost)

# Determine the cheapest method
if ground_shipping_cost < premium_ground_shipping_cost and ground_shipping_cost < drone_shipping_cost:
print("Cheapest method: Ground Shipping $", ground_shipping_cost)
elif premium_ground_shipping_cost < ground_shipping_cost and premium_ground_shipping_cost < drone_shipping_cost:
print("Cheapest method: Premium Ground Shipping $", premium_ground_shipping_cost)
else:
print("Cheapest method: Drone Shipping $", drone_shipping_cost)