Sal's Shipping Syntax Error


I am getting the following error with my Sal’s Shipping project:

I think it has to deal with the “and” statement. I know how to do it a correct way using the hints but I wanted to better understand why this way is not working.

Here is a link to the project:


You’re right about it the ‘and’.
It sees both sides as separate conditions;
So, for example;
elif weight > 2 and <= 6:
you have;
weight > 2
<= 6
(i.e. it doesn’t know what you’re comparing the ‘<= 6’ with).

As an aside;
Your first if statement takes care of all values of weight which are 2 or below, so the following elif (else if) will only run for values which don’t fit that condition.

Hope that helps

1 Like

Thanks! That helps a lot. I changed it to be “elif weight > 2 and weight <= 6” and that made it work. However, you are right in that I don’t need that extra line of code because of my first if statement.

1 Like