Sal's Shipping - Syntax Error

Project: https://www.codecademy.com/courses/learn-python-3/projects/sals-shipping

I appear to be making an easy mistake, but can’t get through the 2nd step. After reviewing other solutions, I don’t know why I’m getting a SyntaxError.

weight = 1

if weight <= 2.0:
  cost_ground = 4.50 + 20
elif weight > 2.0 and <= 6:
  cost_ground = 9.0 + 20
elif weight > 6.0 and <= 10:
  cost_ground = 12 + 20
else weight > 10:
  cost_ground = 14.25 + 20

shipping_cost = cost_ground * weight

print(shipping_cost)

Error I’m Geting:

  File "shipping.py", line 5
    elif weight > 2.0 and <= 6:
                           ^
SyntaxError: invalid syntax

Hi, welcome to the forums!

Can you please include all of your formatted code? You’re defining a function and the control flow statements are indented accordingly and part of that function.

2 Likes

Thank you so much @lisalisaj ! I ended up solving this!

I didn’t define the function to start, and my indentation was off. For anyone who found this looking for the solution, I watched the video help guide associated with the lesson and followed closely. I learned about defining the function, and proper indentation.

:smiley:

1 Like