Sal’s Shipping Project NameError

I literally cannot figure out why I am getting NameErrors with Sal’s Shipping project. I compared with another user’s code, still don’t understand, and as a last resort I even followed everything down to the last detail from the video tutorial and I still cannot get past the error:

Traceback (most recent call last):
File “”, line 46, in
% (cost, method))
NameError: name ‘cost’ is not defined

i dislike this approach, for the very simple reason that its not representative of how you would normally go about debugging code. Because normally, the answer doesn’t exist.

Instead, ask yourself the questions what could be wrong:

  1. have i defined the variable?
  2. How are the scope rules for this variable and do I obey these rules?

As I said, it was a last resort and I had looked at it from multiple angles hence why it was a last resort. I’ve seen other users post regarding copying the walkthrough as well so I don’t understand your point.

But annoyingly, I stressed over nothing. I found that the culprit simply was my print statement was not indented even with my original code prior to copying the walkthrough. So I’ve rewritten it to my liking. It was 2 in the morning during this so excuse my poor attention skills.

Appreciate your help nonetheless.