The Nile - SHIPPING_PRICES not defined?

Hi guys, I’m currently working on my last project (The Nile) for the Python 3 course, and I’ve run into a problem. My code is as follows:

from nile import get_distance, format_price, SHIPPING_PRICES
from test import test_function

# Define calculate_shipping_cost() here:
def calculate_shipping_cost(from_coords,to_coords,shipping_type='Overnight'):
  from_lat, from_long = from_coords
  to_lat, to_long = to_coords
  distance = get_distance(from_lat, from_long, to_lat, to_long)
  shipping_rate = SHIPPNG_PRICES[shipping_type]
  price = distance * shipping_rate
  return format_price(price)

# Test the function by calling 
# test_function(calculate_shipping_cost)

I haven’t touched any of the other files, but when I run my code with test_function I get this error:

Traceback (most recent call last):
  File "", line 15, in <module>
  File "/home/ccuser/workspace/function-args-nile/", line 3, in test_function
  File "/home/ccuser/workspace/function-args-nile/", line 11, in test_shipping
    costs = f((0, 0), (1, 1))
  File "", line 9, in calculate_shipping_cost
    shipping_rate = SHIPPNG_PRICES[shipping_type]
NameError: name 'SHIPPNG_PRICES' is not defined

Have I done something blatantly wrong here or is this an issue with the course?

Note that in your error message, it says SHIPPNG_PRICES is not defined. Spot the typo?

Oh my god, I can’t believe I didn’t spot that. I must have read that over 5 times and missed it every time. Thanks!

1 Like