https://github.com/sarahm44/sals-shipping-project
Uses Python to find the cheapest shipping method for a customer based on weight and price.
https://github.com/sarahm44/sals-shipping-project
codecademy codecademy-courses codecademy-cs codecademy-pro python-basics python3
Last synced: 8 months ago
JSON representation
Uses Python to find the cheapest shipping method for a customer based on weight and price.
- Host: GitHub
- URL: https://github.com/sarahm44/sals-shipping-project
- Owner: sarahm44
- Created: 2025-01-26T04:06:41.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-27T04:12:42.000Z (over 1 year ago)
- Last Synced: 2025-02-09T12:32:00.030Z (over 1 year ago)
- Topics: codecademy, codecademy-courses, codecademy-cs, codecademy-pro, python-basics, python3
- Language: Python
- Homepage:
- Size: 188 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Codecademy Project: Sal's Shipping

## Contents
- [Overview](#overview)
- [Shipping Options](#shipping-options)
- [Pricing Structure](#pricing-structure)
- [Python Program](#python-program)
- [Finding the Best Option for a Customer](#finding-the-best-option-for-a-customer)
## Overview
I was required to write a Python program for Sal's Shipping.
The program:
1. Asks the user for the weight of their package;
2. Tells them which method of shipping is cheapest; and
3. Tells them how much it will cost to ship their package using Sal’s Shippers.
## Shipping Options
Sal’s Shippers has several different options for a customer to ship their package:
* Ground Shipping, which is a small flat charge plus a rate based on the weight of your package.
* Ground Shipping Premium, which is a much higher flat charge, but you aren’t charged for weight.
* Drone Shipping (new), which has no flat charge, but the rate based on weight is triple the rate of ground shipping.
## Pricing Structure
### Ground Shipping
| Weight of Package | Price per Pound | Flat Charge |
| --- | --- | --- |
| 2 lb or less | $1.50 | $20.00 |
| Over 2 lb but less than or equal to 6 lb | $3.00 | $20.00 |
| Over 6 lb but less than or equal to 10 lb | $4.00 | $20.00 |
| Over 10 lb | $4.75 | $20.00 |
### Ground Shipping Premium
Flat charge: $125.00
### Drone Shipping
| Weight of Package | Price per Pound | Flat Charge |
| --- | --- | --- |
| 2 lb or less | $4.50 | $0.00 |
| Over 2 lb but less than or equal to 6 lb | $9.00 | $0.00 |
| Over 6 lb but less than or equal to 10 lb | $12.00 | $0.00 |
| Over 10 lb | $14.25 | $0.00 |
## Python Program
The file [here](https://github.com/sarahm44/sals-shipping-project/blob/main/sals_shipping.py) contains the Python Program to help Sal's Shipping customers select the best option for their shipping needs.
I used if/elif/else statements to define the pricing structure set out above, per this image:

## Finding the Best Option for a Customer
### For a 4.8 pound package
I used the code to answer the question:
* *What is the cheapest method of shipping a 4.8 pound package and how much would it cost?*
To do so I defined the weight variable as per the below:

The output from running the code is:

As such, the cheapest option for the customer is **Ground Shipping** for a price of **$34.40**.
### For a 41.5 pound package
I used the code to answer the question:
* *What is the cheapest method of shipping a 41.5 pound package and how much would it cost?*
To do so I defined the weight variable as per the below:

The output from running the code is:

As such, the cheapest option for the customer is **Ground Shipping Premium** for a price of **$125**.