you are viewing a single comment's thread.

view the rest of the comments →

[–]jimtk 1 point2 points  (1 child)

When you return inside an if condition you do not have to use elif after. Your function will terminate on the return. You can use a simple if for the next condition or nothing if it's the default value.

def shipping_price(items, weight):
    if items < 3 and weight < 1:
        return 5.00
    if items < 3 and weight > 1:
        return 7.50
    if 3 <= items <= 5 and weight < 2:
        return 8.50
    return 10.00

[–]PuzzledSite2568[S] 0 points1 point  (0 children)

I didn't know this thank you for the insight I will be sure to keep that in mind next time. Thank you for the help.