Sals shipping

help pls!
the code keep showing : Traceback (most recent call last):
File “”, line 49, in
%(cost,method) )
NameError: name ‘cost’ is not defined

also, followed the video help but… why is $%.2f and %s means! sorry I am super new in coding…

Hello @linamierke, welcome to the forums! In regards to %s, and %.2f, they are a means of string formatting. Basically, they allow you to use placeholders for variables, and then put the variables on the end:

a = "hello "
b = "world!"
print("%s%s" %(a, b))

This will print:

>>hello world!

This is a good article explaining the different way to format strings in Python: You could also visit the Python docs.
I hope this helps!


@linamierke, if you look at line 49 like the error tells you to, it looks like your print statement is not inside of the function that assigns a value to cost.

1 Like

Thanks everyone! I just needed to remove the print of the first ground and drone part. :sweat_smile: :crazy_face:

1 Like

Thank you!!!

It’s super annoying that CodeAcademy didn’t just gloss over that string formatting but completely disregarded it and assumed learners would somehow magically know it.


I agree!! there are so many small details I need to learn before I can figure out the big picture.! so annoying! glad to know I am not the only one with this issue.