Hello,
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: https://www.codecademy.com/paths/computer-science/tracks/cspath-cs-101/modules/cspath-python-control-flow/projects/python-sals-shipping
Thanks,
Jonathan
Hi,
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
and
<= 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