Sal's Shipping Project Python 3+ Tutorial

I just finished the Sal’s Shipping beginner project and would like to share my code for anyone who is curious or may need help completing this project.

2024-06-12T04:34:00Z

# My Global variables section # Change the global 'weight' variable to match your package weight weight = 0 cost_ground = 0 Drone_shipping = 0 # Ground Shipping print("Ground Shipping: \n") if weight <= 0: cost_ground =+ 0 print("Please provide the total weight of your item(s) in pounds (lbs) \n") elif weight <= 2: cost_ground =+ weight * 1.5 + 5 print("Cost of shipping will cost $" + str(cost_ground)) elif weight <= 6: cost_ground =+ weight * 3.0 + 9 print("Your shipping cost will be $" + str(cost_ground)) elif weight <= 10: cost_ground =+ weight * 4.00 + 11 print("Total cost of shipment $" + str(cost_ground)) elif weight <= 11: cost_ground =+ weight * 4.75 + 10 print ("Your Shipping cost is $" + str(cost_ground)) elif weight <= 24: cost_ground =+ weight * 4.75 + 10.5 print("Your total shipment cost is $" + str(cost_ground)) elif weight >= 25: print("Your item(s) exceed 'Standard Ground' shipping weight.\nYou'll have to pay for 'Premium Ground' shipping. \nThe flat rate is $125.00 (Insurance is available at \ncheckout, and is not included in the flate rate)\n") else: print("Something went wrong!") #Drone Shipping calculator print("\nDrone Shipping: \n") if weight <= 0: print("Please provide the total weight of your item(s) in pounds (lbs)") elif weight <= 2: Drone_shipping =+ weight * 4.50 + 25 print("Your Drone shipment will cost $" + str(Drone_shipping)) elif weight <= 6: Drone_shipping =+ weight * 9.00 + 10 print("Your Drone shipment totals $" + str(Drone_shipping)) elif weight <= 10: Drone_shipping =+ weight * 12 + 0 print("Shipping with this method will cost $" + str(Drone_shipping)) elif weight <= 20: Drone_shipping =+ weight * 14.25 + 0 print("The price to ship your items is $" + str(Drone_shipping)) elif weight == 21: print("Your item(s) are too heavy! You must pay for Ground shipping") elif weight <= 24: print("Your item(s) are too heavy! You must pay for Ground Shipping") else: weight >= 25 print("Your item(s) exceed both 'Drone shipping' and 'Standard Ground'\nshipping weight. You'll have to pay for 'Premium Ground' shipping.\nThe flat rate is $125.00 (Insurance is available at checkout,\nand is not included in the flate rate!)")
# My Global variables section

# Change the global 'weight' variable to match your package weight
weight = 0
cost_ground =  0
Drone_shipping = 0

# Ground Shipping
print("Ground Shipping: \n")
if weight <= 0:
  cost_ground =+ 0
  print("Please provide the total weight of your item(s) in pounds (lbs) \n")
elif weight <= 2:
  cost_ground =+ weight * 1.5 + 5
  print("Cost of shipping will cost $" + str(cost_ground))
elif weight <= 6:
  cost_ground =+ weight * 3.0 + 9
  print("Your shipping cost will be $" + str(cost_ground))
elif weight <= 10:
  cost_ground =+ weight * 4.00 + 11
  print("Total cost of shipment $" + str(cost_ground))
elif weight <= 11:
  cost_ground =+ weight * 4.75 + 10
  print ("Your Shipping cost is $" + str(cost_ground))
elif weight <= 24:
  cost_ground =+ weight * 4.75 + 10.5
  print("Your total shipment cost is $" + str(cost_ground))
elif weight >= 25:
  print("Your item(s) exceed 'Standard Ground' shipping weight.\nYou'll have to pay for 'Premium Ground' shipping. \nThe flat rate is $125.00 (Insurance is available at \ncheckout, and is not included in the flate rate)\n")
else:
  print("Something went wrong!")

#Drone Shipping calculator 

print("\nDrone Shipping: \n")
if weight <= 0:
  print("Please provide the total weight of your item(s) in pounds (lbs)")
elif weight <= 2:
    Drone_shipping =+ weight * 4.50 + 25
    print("Your Drone shipment will cost $" + str(Drone_shipping))
elif weight <= 6:
    Drone_shipping =+ weight * 9.00 + 10
    print("Your Drone shipment totals $" + str(Drone_shipping))
elif weight <= 10:
    Drone_shipping =+ weight * 12 + 0
    print("Shipping with this method will cost $" + str(Drone_shipping))
elif weight <= 20:
    Drone_shipping =+ weight * 14.25 + 0
    print("The price to ship your items is $" + str(Drone_shipping))
elif weight == 21:
    print("Your item(s) are too heavy! You must pay for Ground shipping")
elif weight <= 24:
    print("Your item(s) are too heavy! You must pay for Ground Shipping")
else: 
  weight >= 25
  print("Your item(s) exceed both 'Drone shipping' and 'Standard Ground'\nshipping weight. You'll have to pay for 'Premium Ground' shipping.\nThe flat rate is $125.00 (Insurance is available at checkout,\nand is not included in the flate rate!)")

2 Likes

I hope someone will help, I struggled with the same project

Thank you for the reply!

2 Likes