Function printing weird string

I was playing around in the Sal’s Shipping project under control flows, doing a function with elif. The code is below:

weight = 8.4

def ground_shipping_cost(weight):

if weight <= 2.00:

gr_cost = weight * 1.50 + 20.00 

return gr_cost

elif weight > 2.00 and weight <= 6.00:

gr_cost = weight * 3.00 + 20.00

return gr_cost

elif weight > 6.00 and weight <= 10.00:

gr_cost = weight * 4.00 + 20.00

return gr_cost

elif weight < 10.00:

gr_cost = weight * 4.75 + 20.00

return gr_cost


The result is:

<function ground_shipping_cost at 0x7f3bd3564e18>

Obviously not the intended result, did some google searches before posting but no luck on a solution. Thank you for any assistance!

When you print certain objects which don’t have an obvious representation in string form you’ll get details like that. Bits and pieces like the memory address or class/type.

It looks like you’re printing a function. I’d hazard a guess that name has been assigned to a function instead of the output of a function. Double check the syntax you are using for the function; calling a function has a very specific form.


As @tgrtim already pointed out, you printed the objects address in memory. This is a very easy fix, when you are using print on a function make sure you use the proper syntax.

print(function_name()) (You forgot to add parenthesis in your print statement)

1 Like