Sal's Shipping

I finished the Sal’s Shipping Project and kind of proud of what I came up with and wanted to share my code. Of course there is probably ways to simplify the code, so if you have any suggestions, I would love to hear them.

1 Like

Wow yours looks amazing!
I wrote a very basic one:

weight = 4.8

#Ground Shipping

if weight <= 2:

Cost_ground = weight * 1.50 + 20

elif weight <= 6:

Cost_ground = weight * 3.00 + 20

elif weight <= 10:

Cost_ground = weight * 4.00 + 20

elif weight > 10:

Cost_ground = weight * 4.75 + 20

else:

print(“Please enter valid weight”)

print("Ground Shipping: ", Cost_ground)

#Premium Shipping

Cost_premium = 125

print("Premium Shipping: ", Cost_premium)

#Drone Shipping

if weight <= 2:

Cost_drone = weight * 4.50

elif weight <= 6:

Cost_drone = weight * 9.00

elif weight <= 10:

Cost_drone = weight * 12.00

elif weight > 10:

Cost_drone = weight * 14.25

else:

print(“Please enter valid weight”)

print("Drone Shipping: ", Cost_drone)

1 Like

I mean, the base itself is very similar, I only googled how to concatenate strings and int cause I wanted to throw the dollar sign in front of the numbers, in a long string.
I always end up looking at the task, then try and figure out long winded ways to do it, or formatting the text in a very unnecessary way! But it’s always good to share what you have and compare it to others, it’s a great way to improve your programming skills.

Also, you can format your code on the forums so it makes it a little easier to read.

print('Hello')

Just use three backticks``` then close it off with another 3 :slight_smile:

1 Like