Sals shipping

Can Someone help me do this??

# Ground Shipping

weight = 80

if weight <= 2:

cost_ground = weight * 1.5 + 20

elif weight [SOME INEQUALITY]:

# more calculation

elif weight [SOME INEQUALITY]:

# more calculation

else:

# last calculation

Is your code formatted the same here as it was when you ran it? As it is, the indentation will cause an error.

2 Likes

It says: SOME INEQUALITY means its a hint

not a hint the sals shipping thing or something

I’m not sure what you mean here. In actual code putting something in all caps inside of square brackets is not a hint. That line would likely raise an error saying something like int object is not subscriptable. Execution of your code won’t make it that far, however, since you have the syntax error @jibs mentioned. An if statement has to be followed by a block of code (could be a single line) to be executed if the condition evaluates to truthy.

The stuff inside the if-statement block must be indented appropriately to work.

The instructions for the Sal’s shipping project say approximately:
To calculate the Ground Shipping for a package, using the following:

Ground shipping has a flat charge of $20.00, and in addition to this charge …
   for a weight of 2 lb or less, the price per lb is $1.50
   for a weight that’s over 2 lb but less than or equal to 6 lb, the price per lb is $3.00
   for a weight that’s over 6 lb but less than or equal to 10 lb, the price per lb is $4.00
   for a weight that’s over 10 lb, the price per lb is $4.75

Use that information to set up the inequalities used for the if and elif statements for ground shipping.
(Note: lb = pound )

In each case, you’d find the cost by doing
cost = ( weight_in_lb × price_per_lb ) + flat_charge

There are also 50+ results for Sal’s Shipping alone when one uses the search functionality on the site. Surely, your answer might be found there too.

1 Like

I already done sals shipping have a good day!